Using XSLT properties

XSLT standards define several properties about the XSLT engine itself. Querying for these properties allows to easily identify the engine.

XSLT 1.0

The function system-property() supports by default the following properties :

  • xsl:version : a number giving the version of XSLT implemented by the processor
  • xsl:vendor : a string identifying the vendor of the XSLT processor
  • xsl:vendor-url : a URL identifying the vendor of the XSLT processor (typically its Web site)

The attached stylesheet recon-xslt10.xsl fingerprints a XSLT 1.0 engine.

XSLT 2.0

This version supports some additional properties :

  • xsl:product-name : a string containing the name of the implementation, as defined by the implementer
  • xsl:product-version : a string identifying the version of the implementation, as defined by the implementer
  • xsl:is-schema-aware : returns "yes" if the XSLT processor is schema-aware, or "no" otherwise
  • xsl:supports-serialization : returns "yes" if the XSLT processor offers this feature, or "no" otherwise
  • xsl:supports-backwards-compatibility : returns "yes" if the XSLT processor offers this feature, or "no" otherwise

  The attached stylesheet recon-xslt20.xsl fingerprints a XSLT 2.0 engine.

Enumerating supported features

Needed functions

The XSLT standards define two additional functions used to enumerate the available features :

  • function-available()
  • element-available()

Example

This stylesheet (by "xmlplease.com") uses these functions to test the availability of :

  • XSLT and XPath functions
  • XSLT elements
  • Saxon extensions
  • EXSLT extensions

TODO : include my own examples !

Live demo

If you want to identify the XSLT engine used in your browser and its features, please click on recon-enumerate-features.xml.

This will crash Opera (NULL ptr dereference aka bug DSK-355332) !

Created by Nicolas Gregoire on 2012/01/10 13:47
     

Welcome

Welcome on the XSLT Hacking Encyclopedia !

You may be interested by the Engines and Applications pages.

Link to the blog
Twitter: @Agarri_FR

Tag Cloud

Unknown macro: tagcloud.
Content by Nicolas Grégoire / Agarri
Blog - Follow me @Agarri_FR