MENU
XSLT
Extensible Stylesheet Language Transformations (XSLT) is a language for transforming XML documents. Its functionality overlaps with that of XQuery: XSLT is an XML-based stylesheet language that is stronger in handling narrative documents with a flexible structure, while XQuery is a functional language that is stronger in data handling, such as relational joins.To have a browser apply an XSLT transformation to an XML document, add the following processing instruction to the XML document:
| <?xml-stylesheet type="text/xsl" href="x.xslt"?> |
x.xslt is the file containing the XSLT stylesheet.
An online XSLT 3.0 processor is available at https://xsltfiddle.liberty-development.net/. The Notepad++ editor also has a plugin that supports XSLT.XSLT 3.0 became a W3C Recommendation on 8 June 2017 and remains the current, full Recommendation-level version. A superset, XSLT 4.0, is under active development as a Community Group draft by the W3C's XQuery and XSLT Extensions Community Group (QT4CG) and is not yet an official W3C Recommendation; see XSLT 4.0. Full documentation for XSLT 3.0 is available at https://www.w3.org/TR/xslt-30/.
If the source XML document uses a namespace, the same namespace must also be declared in the XSLT stylesheet.
This chapter covers the following topics:
- Basic Flow Control
- Constructing Nodes
- Validation
- Sorting and Merging
- Multiple Templates
- Module Assembly
- Declarations
- Analysis
- Streaming, Accumulators and Maps
- Other Built-in Functions
- XSLT 4.0