Appendix C. Backward Compatibility

The designers of XSLT 2.0 and XPath 2.0 took a great deal of care to ensure that existing code should continue to work unchanged as far as possible, and in my experience, moving forward to 2.0 rarely causes any compatibility problems. However, because there are so many new features, and particularly because of the changes in the type system, a few incompatibilities were inevitable. This appendix summarizes the areas where you are most likely to encounter problems. It's not a completely comprehensive list; for that, you should go to the relevant appendices of the W3 C specifications for XSLT 2.0, XPath 2.0, and Functions and Operators. However, many of the incompatibilities described in those appendices are such obscure edge cases that you are very unlikely to encounter them in practice.

You can think of the transition from XSLT 1.0 to XSLT 2.0 as happening in three stages, though you may choose to do all three at once:

  • The first stage takes the stylesheet unchanged, still specifying «version="1.0"», and runs it under an XSLT 2.0 processor instead of an XSLT 1.0 processor.

  • The next stage is to change the stylesheet to specify «version="2.0"». This has the effect of switching off backward-compatibility mode.

  • The final stage is to modify the stylesheet to take advantage of new facilities introduced in XSLT 2.0 and XPath 2.0; notably, the ability to validate the source documents against a schema.

There is potential for transition problems to occur at each ...

Get XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.