April 2001
Intermediate to advanced
112 pages
2h 15m
English
<xsl:choose>
<xsl:choose> ... </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.
Read now
Unlock full access