Parameters and Variables


Tests and Conditions

xsl:if offers the equivalent of an if statement. The content of xsl:if is generated if the test is true:

 <xsl:if test="not(position()=last())"> </xsl:if> 

xsl:choose is the equivalent of the Java switch statement. It selects one among a number of possible alternatives:

 <xsl:choose>       <xsl:when test="Currency='USD'">Dollars</xsl:when>       <xsl:when test="Currency='EUR'">Euros</xsl:when>       <xsl:when test="Currency='BEF'">Belgian Francs</xsl:when>       <xsl:when test="Currency='CAD'">Canadian Dollars</xsl:when>    </xsl:choose> 


There is no direct equivalent for the if/then/else statement in XSLT, but it can be simulated as follows :

 <xsl:choose/>           <xsl:when test="Confidential='true'">              <B>For Your Eyes Only</B>           </xsl:when>           <xsl:otherwise><B>You Can Circulate</B></xsl:otherwise>        </xsl:choose> 


Applied XML Solutions
Applied XML Solutions
ISBN: 0672320541
EAN: 2147483647
Year: 1999
Pages: 142 © 2008-2017.
If you may any questions please contact us: