[xsl] An unintended incompatibility with xsl:number

Subject: [xsl] An unintended incompatibility with xsl:number
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Wed, 16 Jun 2010 23:10:44 +0100
The XSL Working Group needs your help to try out a test case.

Another case has been discovered of a situation where the XSLT 2.0 rules for xsl:number appear to be unintentionally incompatible with the XSLT 1.0 rules. The last time this arose, it was an edge case and we found that XSLT 1.0 processors showed no uniformity at all in the way it was handled. This time, it seems to be less of an edge case, and it might be that it hasn't been noticed until now because Saxon and some other 2.0 processors are actually following the XSLT 1.0 rules.

Consider this source document:


and this stylesheet:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template match="/">
<xsl:for-each select="//title">
<xsl:number from="a" count="a" level="single"/>


The XSLT 2.0 specification is explicit that the result should be <out>1</out>

The XSLT 1.0 specification is not quite so clear-cut, but the simplest reading of it is to produce the result <out/>, which is what both Saxon 9.x and Saxon 6.5.5 produce. But we know of other XSLT 2.0 implementations that correctly follow the 2.0 specification.

The Working Group, before deciding whether to issue an erratum to XSLT 2.0 to change the behaviour to match XSLT 1.0, is interested to know how existing implementations (both 1.0 and 2.0) handle this. If you could try the above stylesheet on your favourite 1.0 or 2.0 processor and submit the results, I will collate them. Thank you for your assistance.

In practice, using the from attribute with level="single" isn't very useful, so it may not make much practical difference what we decide. But if XSLT 1.0 processors are showing consistent results, this will add weight to the argument in favour of changing 2.0 to be compatible.

Michael Kay
on behalf of the XSL Working Group

Current Thread