The Extensible Stylesheet Language

The Extensible Stylesheet Language (XSL) is one of the most intricate specifications in the XML family. XSL can be broken into two parts: XSLT, which is used for transformations, and XSL Formatting Objects (XSL-FO). While XSLT is currently in widespread use, XSL-FO is still maturing; both, however, promise to be useful for any XML developer.

This section will provide you with a firm understanding of how XSL is meant to be used. For the very latest information on XSL, visit the home page for the W3C XSL working group at

As we mentioned, XSL works by applying element-formatting rules that you define for each XML document it encounters. In reality, XSL simply transforms each XML document from one series of element types to another. For example, XSL can be used to apply HTML formatting to an XML document, which would transform it from:

<?xml version="1.0"?>
<OReilly:Book title="XML Comments">
 <OReilly:Chapter title="Working with XML">
  <OReilly:Image src=""/>
  <OReilly:HeadA>Starting XML</OReilly:HeadA>
    If you havent used XML, then ...

to the following HTML:

   <TITLE>XML Comments</TITLE>
   <H1>Working with XML</H1>
   <img src=""/>
   <H2>Starting XML</H2>
   <P>If you havent used XML, then ...</P>

If you look carefully, you can see a predefined hierarchy that remains from ...

Get Webmaster in a Nutshell, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.