December 2002
Intermediate to advanced
576 pages
32h
English
<xsl:choose>
The <xsl:choose> element, in conjunction
with the elements <xsl:when> and
<xsl:otherwise>, offers the ability to
perform multiple condition tests. For example:
<xsl:template match="chapter/title">
<xsl:choose>
<xsl:when test="[position( )=1]">
Start Here:
</xsl:when>
<xsl:otherwise>
Then Read:
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates/>
</xsl:template>This example matches against each of the qualifying
<title> elements, but it must test each
<title> element to determine how to format
it. Here, formatting depends on whether the element is first. The
string Start Here: is applied before the first
<title> element, and the string
Then Read: is placed before the others.
<xsl:choose> ... </xsl:choose>
Read now
Unlock full access