XSL introduction

Extensible Stylesheet Language (XSL) allows you to format and reorganize existing XML documents into another format (for example, XML or HTML).

You can use XSL to reformat an XML file to specify the how the data is to be presented on the web via XSLT stylesheets. You can also write XSLT stylesheets to reorganize an XML document to remove or add elements or to change it into another XML document. XSLT stylesheets are written in XML to achieve this.

This process has two basic components:

  • Use XSL stylesheets to define a set of patterns and templates you want to use to replace XML elements. A pattern identifies the XML element, and the corresponding template is used by an XSL processor to actually replace the XML element. For example, you can transform data elements in an XML document to display appropriately in a browser or mailing label.
  • Use XSLT documents to transform the hierarchy of XML data into a different kind of tree, reordering elements as you prefer. For example, you can add a table of contents or an index to a set of data that does not have one. You can also use XSLT to transform the grammar of XML documents. For example, you can transform the grammar for a set of incoming XML request documents to a different XML grammar required by the receiving application.

These technologies do more than format the display of an XML document. They change it so that it becomes a different kind of document. In conjunction with other XML tools and extensions, such as parsers and XML Linking Language (XLink), you can produce new documents formats such as specific word processing formats, portable document format (PDF), HTML, and more.