The Extensible Stylesheet Language Family (XSL)
Introduction
XSLT and XSL-FO are W3C Recommendations for defining XML document transformation and presentation. Use XSLT to transform documents into XSL-FO for printing or viewing; you can also use XSLT as a general XML-aware programming and transformation language, and you can use XSL-FO directly without XSLT.
A typical application might be taking groups of
XML documents to
PDF:
XSL Transformations: XSLT
XSL Transformations (XSLT 2.0) is a language for transforming XML documents into other XML documents, text documents or HTML documents. You might want to format a chapter of a book using XSL-FO, or you might want to take a database query and format it as HTML.
With XSLT 2.0, processors can operate not only on XML but on
anything that can be made to look like XML: relational database
tables, geographical information systems, file systems, anything from
which your XSLT processor can build an
XDM instance.
In some cases an XSLT 2.0 processor might also be able to work directly
from a database of XDM instances. This ability to operate on multiple
input files in multiple formats, and to treat them all as if they were
XML files, is very powerful. It is shared with
XQuery, and with anything
else using XPath 2.0:
Template-Driven Approach
XSLT uses a template-driven approach to transformations: you write a template that shows what happens to any given input element. For example, if you were formatting a letter to product HTML for the Web, you might have a template to match an underlined passage and make it come out in italics:
Now suppose the input document contains the following fragment of XML:
The template would match the underline element, and produce the following HTML fragment:
Wildly Popular
XSLT has become the language of choice for a very wide range of XML applications. It is of course still used to produce XSL-FO documents for printing, but it is also used to integrate back-end software for Web sites. You will find XSLT (version 1) inside most modern Web browsers, so that XML can be transformed on the fly without the user even noticing; you will find XSLT on the desktop, in servers, in network appliances, and forming a basic and dependable part of computer infrastructure almost everywhere you look.
Learn More
You can read the XSLT 2.0 Recommendation; there is also an older XSLT 1.0 Recommendation which will be useful if your software has not yet been upgraded; Web browsers in particular generally implement the 1.0 version.
If you find a mistake in any W3C specification, see the Status section of the document concerned for instructions on how to send comments. Different documents need comments sent to different places, but all comments do get read, and we will (in time) reply.
There is a public mailing list for XSL, XSL-List, hosted outside the W3C.
This is the end of the new page so far.
- the XML Path Language (XPath)
- an expression language used by XSLT to access or refer to parts of an XML document. (XPath is also used by the XML Linking specification)
- XSL Formatting Objects (XSL-FO)
- an XML vocabulary for specifying formatting semantics
For background information on style sheets, see the Web style sheets resource page. XSL is developed by the W3C XSL Working Group (members only) whose charter is to develop the next version of XSL. XSL is part of W3C's XML Activity, whose work is described in the XML Activity Statement.