D.5. How Do I Implement an if-else Statement?For whatever reason, XSLT doesn't provide an <xsl:else> element. To create an if-else statement, you need an <xsl:choose> element with a single <xsl:when> element and a single <xsl:otherwise> element. If the test attribute of the <xsl:when> element is true, then the contents of the <xsl:when> are evaluated; if not, the contents of the <xsl:otherwise> element are. See the Reference A.6 entry in Appendix A, "XSLT Reference" for a complete discussion of this element and some examples. Copyright © 2002 O'Reilly & Associates. All rights reserved. |
|