Extensible Stylesheet Language Transformation (XSLT) is a declarative, XML-based language that is used to present or transform XML data. The transformation of XML data involves taking the source document, considered to be a tree of nodes, and creating a second XML document from it in another format. The XSLT style sheet provides the rules and format that specify how the output document is built. If the output is in an appropriate format such as HTML, it can be used for presentation of the source document.
XSLT matches components (or nodes) of an XML document—by using XPath (XML Path Language (XPath): A language used to address parts of an XML document. XPath also provides basic facilities for manipulation of strings, numbers, and Booleans.) expressions—with XSLT templates, and then applies transformation and formatting rules to the matched components. XSLT templates are structures that specify the components of the XML document to be transformed, as well as the final format into which the matching components should be transformed. Since XSLT is implemented in XML, it defines a special set of elements and attributes that can be used to create the transformations. XSLT can be used to transform any type of XML document, including XML data, XML Schemas, or other XSLT style sheets.
From a programming perspective, XSLT supports a number of general methods for processing XML data:
- Data types A small set of data types, including Boolean, number, string, and node-set.
- Operations Various operations that can be performed on the XML data, including template, apply-template, sort, and output.
- Flow control Programming statements used to control the flow of the transformation, including if, for-each, and choose.