Previous | Next | Indexes
Zvon > Tutorials > XSLT 2.0 Tutorial > Use When (2/2) >

Use-when for compatibility

Attribute use-when can be very useful in writing stylesheets for several XSLT processors.

XSLT

      <xsl:stylesheet
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  version="2.0">
            <xsl:output  method="xml"
                        indent="yes"
                        omit-xml-declaration="yes"/>

            <xsl:template  match="/aaa">
                  <v>
                        <xsl:value-of  select="system-property('xsl:product-name')"/>
                  </v>
                  <saxon-extensions-can-be-used  xsl:use-when="system-property('xsl:product-name')='SAXON'"/>
                  <xalan-extensions-can-be-used  xsl:use-when="system-property('xsl:product-name')='XALAN'"/>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa  x="3"/>
Output

      <v>SAXON</v>
      <saxon-extensions-can-be-used/>


Previous chapter: Errors
Next chapter: Collations
Previous page: Use-when attribute
Next page: - - -