2.1. Boilerplates for XSLT Stylesheets

Building upon the information presented in Chapter 1, a boilerplate XSLT stylesheet, using <xsl:stylesheet> as the document element, would result in the basic structure required for any stylesheet, as shown in Example 2-1 .

The document element is used to contain the rest of the stylesheet, as well as providing a convenient place to declare the version and namespace for XSL. The XSLT version is shown here as version="1.0" and the XSL namespace, defined using the xmlns namespace declaration attribute, is shown here as:

Example 2-1. Basic XSLT stylesheet structure.
 <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" > <!--The various top-level elements go here ...

Get XSLT and XPATH: A Guide to XML Transformations now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.