W3C

XSL Transformations (XSLT) Version 3.0

W3C Recommendation 8 June 2017

This version:
https://www.w3.org/TR/2017/REC-xslt-30-20170608/
Latest version:
https://www.w3.org/TR/xslt-30/
Previous versions:
https://www.w3.org/TR/2017/PR-xslt-30-20170418/
https://www.w3.org/TR/2017/CR-xslt-30-20170207/
https://www.w3.org/TR/2015/CR-xslt-30-20151119/
https://www.w3.org/TR/2014/WD-xslt-30-20141002/
https://www.w3.org/TR/2012/WD-xslt-30-20131212/
https://www.w3.org/TR/2012/WD-xslt-30-20120710/
Editor:
Michael Kay, Saxonica <http://www.saxonica.com/>

Please check the errata for any errors or issues reported since publication.

See also translations.

The following associated resources are available:


Abstract

This specification defines the syntax and semantics of XSLT 3.0, a language designed primarily for transforming XML documents into other XML documents.

XSLT 3.0 is a revised version of the XSLT 2.0 Recommendation [XSLT 2.0] published on 23 January 2007.

The primary purpose of the changes in this version of the language is to enable transformations to be performed in streaming mode, where neither the source document nor the result document is ever held in memory in its entirety. Another important aim is to improve the modularity of large stylesheets, allowing stylesheets to be developed from independently-developed components with a high level of software engineering robustness.

XSLT 3.0 is designed to be used in conjunction with XPath 3.0, which is defined in [XPath 3.0]. XSLT shares the same data model as XPath 3.0, which is defined in [XDM 3.0], and it uses the library of functions and operators defined in [Functions and Operators 3.0]. XPath 3.0 and the underlying function library introduce a number of enhancements, for example the availability of higher-order functions.

As an implementer option, XSLT 3.0 can also be used with XPath 3.1. All XSLT 3.0 processors provide maps, an addition to the data model which is specified (identically) in both XSLT 3.0 and XPath 3.1. Other features from XPath 3.1, such as arrays, and new functions such as random-number-generatorFO31 and sortFO31, are available in XSLT 3.0 stylesheets only if the implementer chooses to support XPath 3.1.

Some of the functions that were previously defined in the XSLT 2.0 specification, such as the format-dateFO30 and format-numberFO30 functions, are now defined in the standard function library to make them available to other host languages.

XSLT 3.0 also includes optional facilities to serialize the results of a transformation, by means of an interface to the serialization component described in [XSLT and XQuery Serialization]. Again, the new serialization capabilities of [XSLT and XQuery Serialization 3.1] are available at the implementer’s option.

This document contains hyperlinks to specific sections or definitions within other documents in this family of specifications. These links are indicated visually by a superscript identifying the target specification: for example XP30 for XPath 3.0, DM30 for the XDM data model version 3.0, FO30 for Functions and Operators version 3.0.

Status of this Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at https://www.w3.org/TR/.

This document is governed by the 1 March 2017 W3C Process Document.

This is a Recommendation of the W3C. It was developed by the W3C XSLT Working Group.

This Recommendation specifies XSLT version 3.0. Changes since XSLT 2.0 are listed in J Changes since XSLT 2.0. The only incompatibilities with XSLT 2.0 relate to the way in which certain error conditions are handled: the details are given in N Incompatibilities with XSLT 2.0.

No substantive changes have been made to this specification since its publication as a Proposed Recommendation. A few corrections and clarifications have been made to non-normative text: these are listed in M Changes since the Proposed Recommendation of 18 April 2017.

This document has been reviewed by W3C Members, by software developers, and by other W3C groups and interested parties, and is endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited from another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.

A test suite for XSLT 3.0, containing over 11,000 test cases, is available at https://dvcs.w3.org/hg/xslt30-test/. The metadata for each test case describes any dependencies on optional or implementation-defined features of the specification, and provides expected results for each test. Documentation on how to run tests is available within the test suite. New tests may be added from time to time, and contributions are welcome.

An implementation report is available detailing test results for various implementations. This link points to the latest version of the report; older versions are available within the repository. New submissions of test results are welcome. Submitted test results and a stylesheet for generating the reports can be found within the repository.

This specification has been developed in conjunction with [XPath 3.0] and other documents that underpin both XSLT and XQuery. XSLT 3.0 requires support for XPath 3.0 augmented by a selection of features from XPath 3.1 which are described in 21 Maps and 22 Processing JSON Data. XSLT 3.0 in addition allows a processor to support the whole of XPath 3.1, in which case it must do so as described in 27.7 XPath 3.1 Feature. In the event that future versions of XPath are defined beyond XPath 3.1, this specification allows XSLT 3.0 processors to provide support for such versions, but leaves it implementation-defined how this is done. References in this document to XPath and related specifications are by default to the 3.0 versions, but such references should be treated as version-agnostic unless the relevant prose indicates otherwise.

XSLT 3.0 specifies extensions to the XDM 3.0 data model, to the XPath 3.0 language syntax, and to the XPath 3.0 function library to underpin the introduction of maps, which were found necessary to support some XSLT streaming use cases, to enable XSLT to process JSON data, and to make many other processing tasks easier. These extensions have been incorporated into XDM 3.1 and XPath 3.1. Although XDM 3.1 and XPath 3.1 have reached Recommendation status, XSLT 3.0 has not been made dependent on XPath 3.1, other than those features needed to meet the XSLT 3.0 requirements.

Please report errors in this document using W3C’s public Bugzilla system (instructions can be found at https://www.w3.org/XML/2005/04/qt-bugzilla). If access to that system is not feasible, you may send your comments to the W3C XSLT/XPath/XQuery public comments mailing list, public-qt-comments@w3.org. It will be very helpful if you include the string “[XSLT30]” in the subject line of your report, whether made in Bugzilla or in email. Please use multiple Bugzilla entries (or, if necessary, multiple email messages) if you have more than one comment to make. Archives of the comments and responses are available at https://lists.w3.org/Archives/Public/public-qt-comments/.

The same mechanism may be used for reporting errors in the test suite.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.