[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: testing strings


Subject: RE: testing strings
From: Bill Abbas <babbas@xxxxxxxxxx>
Date: Tue, 16 Nov 1999 15:02:31 -0800

Nevermind, I figured it out:

	<xsl:template match="Whatever">
      	  <xsl:variable name="var" select="normalize(Choice/text())"/>
	        <xsl:choose>
      	         <xsl:when test="starts-with($var,'true')"> 
            	            Choice is true
	                </xsl:when>
      	          <xsl:otherwise>
            	            Choice is false
	                </xsl:otherwise>
      	  </xsl:choose>
	</xsl:template>

-----Original Message-----
From: Bill Abbas 
Sent: Tuesday, November 16, 1999 2:08 PM
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: testing strings



Hi, 

Pretty basic question about how to handle strings.  If I have an element in
XML like so

         	<Whatever>
                <Choice>
                    true
                </Choice>
	</Whatever>
            
And I want to output one of two values, depending on whether the Choice
element is true or false.  

The following transform doesn't seem to do the trick.

	<xsl:template match="Whatever">
	        <xsl:choose>
            	    <xsl:when test="{Choice}='true')">
	                        Choice is true
            	    </xsl:when>
	                <xsl:otherwise>
            	            Choice is false
	                </xsl:otherwise>
	        </xsl:choose>
	</xsl:template>

What is the proper syntax for a test to compare strings?  Thanks.

-Bill


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords
xml