XSLT - Flow Control

Card Puncher Data Processing

About

Statement

If

<xsl:template match="LIST">
 <xsl:if test="@type='ordered'"> 
    <ol>
   <xsl:apply-templates/>
    </ol>
 </xsl:if>
 <xsl:if test="@type='unordered'">
    <ul>
    <xsl:apply-templates/>
    </ul>
 </xsl:if>
</xsl:template>

where:

Single quotes are required around the attribute values. Otherwise, the XSLT processor attempts to interpret the word ordered as an XPath function instead of as a string.

Choose

<xsl:choose>
    <xsl:when test="$index &lt;= 1">
        <xsl:value-of select="$low"/>
    </xsl:when>
    <xsl:otherwise>
    <xsl:text>Otherwise</xsl:text>
      </xsl:otherwise>
</xsl:choose>





Discover More
Card Puncher Data Processing
XSLT - Variable

There are two elements that can be used to bind variables: xsl:variable and xsl:param. The difference is that the value specified on the xsl:param variable is only a default value for the binding;...
Card Puncher Data Processing
XSLT/XPATH - Expression

XSLT uses the expression language defined by XPath. Expressions are used in XSLT for a variety of purposes including: selecting nodes for processing; specifying conditions for different ways of processing...



Share this page:
Follow us:
Task Runner