Re: [xsl] XSLT 3.0 and XML Schema version

Subject: Re: [xsl] XSLT 3.0 and XML Schema version
From: "Sean B. Durkin" <sean@xxxxxxxxxxxxxxxxx>
Date: Wed, 20 Nov 2013 22:25:34 +1100
Michael Kay,

Thanks for that clarification.


Faithfully, Sean B. Durkin On 20/11/2013 10:16 PM, Michael Kay wrote:
On 20 Nov 2013, at 10:16, Sean B. Durkin <sean@xxxxxxxxxxxxxxxxx> wrote:

If I feed the following stylesheet into an XSLT 3 processor, will the output be implementation dependant?
No, it will be implementation-defined ;-)

The difference is that when things are implementation-defined, a conformant processor has to document what it does.

Cross-dependencies between versions of specs are something that's typically fixed only at a late stage of spec publication. However, it's very likely that XSLT 3.0 will specify XPath 3.0, and XPath 3.0 is now a Proposed Rec and therefore very unlikely to change, and XPath 3.0 says

* It is implementation-defined whether the type system is based on [XML Schema 1.0] or [XML Schema 1.1].

Date/time arithmetic is of course defined by XPath not by XSLT.

If the XML processor under the XSLT processor respects XSD 1.0, then, by my calculations, the output should be ...

<aYearLater>0001-02-29</aYearLater>

... but if XSD 1.1, then it should be ...

<aYearLater>0000-03-01</aYearLater>

On a side note, if you change the xsl:stylesheet/@version to 2.0 and feed the stylesheet to Saxon HE 9.5, then you get output ...

<aYearLater>0001-03-01</aYearLater>

Saxon has a configuration-level switch allowing you to choose between XSD 1.0 and XSD 1.1 support. This is orthogonal to the choice of XSLT or XPath version. If you choose XSD 1.1, then I think you will get 0000-03-01.

(For those unfamiliar with the detail, XSD 1.1 changed the definition of non-positive year numbers to align with ISO 8601, which clarified that in the "proleptic Gregorian calendar" there is a year 0. This differs from the convention used by historians, where the year before 1AD is 1BC; but historians do not generally use the proleptic Gregorian calendar anyway.)

One thing the specs don't really clarify is what format-date() should do with negative years when the calendar is "AD". I think the right answer is probably that -0001-01-01 should be output as 1 Jan 2BC.

Michael Kay
Saxonica

Current Thread