Jesper Tverskov, October 21, 2008

Elements and functions available in XSLT processors

In XSLT we can use the functions element-available() and function-available() to see what instruction elements and functions are available including extensions. I have made an XSLT stylesheet testing the availability of all XSLT instruction elements, XSLT and XPath functions and Saxon and EXSLT extensions.

The XSLT stylesheet, element-function-available.xsl, can be used to create a report for any XSLT processor. Some XSLT 1.0 processors have limitations making the stylesheet not working (see below). The stylesheet itself only makes use of XSLT 1.0 but the version attribute says XSLT 2.0 to make the stylesheet work as intended both in XSLT 2.0 and in XSLT 1.0 processors.

For extensions the stylesheet only looks at EXSLT and Saxon being the most relevant for most of us. If someone provides me with the necessary information in an easy to use format, I might find the time to add support for other proprietary extensions.

1. XSLT 2.0 processors

1.1 AltovaXML 2008

AltovaXML reports that all XSLT and XPath functions are available except type-available(). In AltovaXML also non-instruction elements can be tested with element-available(). All XSLT elements are available except xsl:strip-space and xsl:preserve-space. Also it is reported that xsl:transform is not available but it must be a bug considering that all other non-instruction elements report "true".

No EXSLT extensions are available. As a matter of fact, AltovaXML supports no extensions of any kind. If extra functionality is needed the parameter method is the only option available in AltovaXML.

1.2 SAXON SA 9.1.0.3

All XSLT instruction elements are available. All XSLT and XPath functions are available. All Saxon extensions are available. More or less all relevant EXSLT extensions are available.

1.3 SAXON B 9.1.0.3

All XSLT instruction elements are available. All XSLT and XPath functions are available. A few Saxon extensions are not available(they are only available in schema-aware version of Saxon). More or less all relevant EXSLT extensions are available.

1.4 Gestalt 1.0

All XSLT 2.0 and XPath 2.0 functions are available except dateTime(). All instruction elements are reported available. No EXSLT extensions are supported.

2. XSLT 1.0 processors

2.1 Saxon 6.5.5

The stylesheet is working but the information reported is junk due to known limitations in Saxon 6.5.5, function-available() only accepting a literal string as argument.

2.2 Transformix (Firefox)

All XSLT 1.0 and XPath 1.0 functions are available, except unparsed-entity-uri() in XSLT. All XSLT elements including non-instruction elements are reported available except xsl:namespace-alias. Very few EXSLT extensions are available, exsl:node-set() and exsl:object-type() are among them.

2.3 MSXML 3

The stylesheet works in all Microsoft XSLT 1.0 processors I have tested:

  1. MSXML 3.0
  2. MSXML 4.0
  3. MSXML 6.0
  4. XslTransform, .NET 1,
  5. XslCompiledTransform, .NET 2

In MSXML 3 as in Internet Explorer all functions in XSLT and XPath 1.0 are available and all elements including non-instruction elements. No EXSLT extensions are supported.

I have not tested for Microsoft extensions like msxsl:script (the most important of all extensions). I’m not sure that Microsoft processors have other extensions?

2.4 XslCompiledTransform/.NET 2

All functions in XSLT 1.0 and XPath 1.0 are available except unparsed-entity-uri() in XSLT. All XSLT instruction elements are available and interestingly enough exsl:node-set() and exsl:object-type(). I have not tested for Microsoft extensions like msxsl:script (the most important of all extensions). I’m not sure that Microsoft processors have other extensions?

2.5 Stylesheet not working

For reasons not known to me, element-function-available.xsl doesn’t work in the following XSLT 1.0 processors (there are many others not tested). The reason could be the same limitation as in Saxon 6.5.5, that function-available()only accepts a literal string as argument (?):

  1. Opera as implemented in the Opera browser, crashing.
  2. Libxslt as implemented in Google Chrome, partial transformation.
  3. Jaxp as implemented in Stylus Studio, error messages.
  4. Xalan as implemented in Oxygen, error messages.
  5. Xsltproc as implemented in Oxygen, error messages.

If someone can provide me with information that can fix the stylesheet for one or more of those XSLT 1.0 processors, I might find the time to do so. Some of the error messages above are about 2.0 functions, current-date() and format-date(), in conditional code they should not see! Even when I remove those functions we get other error messages.

Updated 2009-08-06