xsl:if

  • Conditionally process a part of the template.

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:template name="test">
        <xsl:if test="/@test">
          ...
        </if>
      </xsl:template>
    </xsl:stylesheet>
    					
  • 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.