xsl:choose ... xsl:when ... xsl:otherwise

  • Conditionally process a part of the template, allowing alternatives.

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:template name="test">
          <xsl:when test="@test='1'">
          <xsl:when test="@test='2'">
  • The test attribute value always expects a boolean result, the value is converted to a boolean as if by a call to the XPath boolean function.


It is not allowed to have any content in the xsl:choose element.