Table of Contents

XSLT - Flow Control

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>