Used to choose one of a number of alternative outputs.
Content: ( xsl:when+ , xsl:otherwise? )
Permitted parent elements: any XSLT element whose content model is sequence-constructor; any literal result element
Element has no attributes
The element typically contains a number of xsl:when elements, each with a separate test condition.
xsl:when element whose condition matches the current
element in the source document is expanded, the others are ignored. If none of
the conditions is satisfied, the xsl:otherwise child element, if any, is expanded.
The test condition in the
xsl:when element is a boolean expression.
The full syntax of expressions is outlined in XPath Expression Syntax.
<xsl:choose> <xsl:when test="@cat='F'">Fiction</xsl:when> <xsl:when test="@cat='C'">Crime</xsl:when> <xsl:when test="@cat='R'">Reference</xsl:when> <xsl:otherwise>General</xsl:otherwise> </xsl:choose>