XPath 2.0 conformance

Saxon for many years has implemented the full XPath 2.0 language as defined in the Second Edition Recommendation of 14 December 2010.

Recent Saxon releases focus primarily on XPath 3.1 support, and deliver XPath 2.0 when required by restricting some of the capabilities of the XPath 3.1 processor. For example, this is the default for XPath expressions appearing within assertions or conditional type alternatives in XSD 1.1 schemas. However, a few constructs behave as defined in XPath 3.1 even when 2.0 is requested: details appear below.

Saxon-EE 9.9 passes 15238 out of 15242 XPath 2.0 tests in the W3C test suite. The failures occur in cases where XPath 3.1 relaxes the rules and it is not practical or sensible for Saxon to enforce several different sets of constraints. In particular:

The general rule is that when Saxon acts as an XPath 2.0 processor, all correct (non-error) inputs produce a conformant result, but a small number of error cases are not detected.

There are also a few situations where XPath 3.1 chose to introduce incompatible changes. For example, fn:format-time() was changed in 3.1 to truncate the fractional seconds value rather than rounding it. In such cases Saxon follows the XPath 3.1 rules, since the change was made for good reasons.