Top-Level Stylesheet Elements

Top-Level Stylesheet Elements

XSL defines a number of top-level elements that can be direct child elements of <xsl:stylesheet> :

  • <xsl:attribute-set>

  • <xsl:decimal-format>

  • <xsl:import>

  • <xsl:include>

  • <xsl:key>

  • <xsl: namespace-alias >

  • <xsl:output>

  • <xsl:param>

  • <xsl: preserve-space >

  • <xsl: strip-space >

  • <xsl:template>

  • <xsl:variable>

The XSLT 1.1 working draft adds one more top-level element:

  • <xsl:script>

Youll see all these official top-level XSLT elements in this book.

Note that in addition to all these top-level elements, you can also use normal XML comments throughout, because XSLT stylesheets are also XML documents:

 <?xml version="1.0"?>  <xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">      <!-- This template matches all PLANETS elements -->      <xsl:template match="/PLANETS">          <HTML>              <HEAD>              .              .              . 

In addition to the official top-level elements, several XSLT processors define their own top-level elements, and those elements use namespaces that are not the same as the XSL namespace. What these implementer-defined top-level elements do is up to the creator of the XSLT processor.

You can also define your own top-level elements, called user -defined top-level elements . These elements must have a different namespace from XSL and implementer-defined top-level elements. The XSLT processor ignores user-defined top-level elements, but because you can gain access to the whole document yourself with the document function (which youll see in Chapter 8), you can make use of these elements yourself.

Of all the top-level elements, the most popular is the <xsl:template> element:

 <?xml version="1.0">  <xsl:stylesheet version="1.0" xmlns::xsl="http://www.w3.org/1999/XSL/Transform">      <xsl:template>      .      .      .      </xsl:template>      .      .      . 

Creating and using templates is the very heart of XSLT, and Ill take a look at that element next , as we continue writing planets.xsl.



Inside XSLT
Inside Xslt
ISBN: B0031W8M4K
EAN: N/A
Year: 2005
Pages: 196

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net