9.6. The <xsl:choose> Instruction Element
The <xsl:choose> instruction element allows several conditions to be tested for the selective processing of nodes. Using two child elements, <xsl:when> and <xsl:otherwise>, it provides alternatives to be used for testing and one default if no condition is met. Each test provides a new template for instantiation when the condition for that test is met. The <xsl:choose> element must contain one or more <xsl:when> elements, followed by one optional <xsl:otherwise> element. The <xsl:choose> element does not have any attributes, as shown in the following element model definition:
<!-- Category: instruction --> <xsl:choose> <!-- Content: (xsl:when+, xsl:otherwise?) --> </xsl:choose>
The <xsl:choose> instruction ...
Get XSLT and XPATH: A Guide to XML Transformations now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.