10.6 XSLT Style Sheet Structure

Team-Fly    

 
Webmaster in a Nutshell, 3rd Edition
By Robert Eckstein, Stephen Spainhour
Table of Contents
Chapter 10.  XML

10.6 XSLT Style Sheet Structure

The general order for elements in an XSL style sheet is as follows :

 <xsl:stylesheet version="1.0"       xmlns:xsl="http://www.w3.org/1999/XSL/Transform">    <xsl:import/>    <xsl:include/>    <xsl:strip-space/>    <xsl:preserve-space/>    <xsl:output/>    <xsl:key/>    <xsl:decimal-format/>    <xsl:namespace-alias/>    <xsl:attribute-set>...</xsl:attribute-set>    <xsl:variable>...</xsl:variable>    <xsl:param>...</xsl:param>    <xsl:template match="...">       ...    </xsl:template>    <xsl:template name="...">       ...    </xsl:template> </xsl:stylesheet> 

Essentially, this ordering boils down to a few simple rules. First, all XSL stylesheets must be well- formed XML documents, and each <XSL> element must use the namespace specified by the xmlns declaration in the <stylesheet> element (commonly xsl:). Second, all XSL stylesheets must begin with the XSL root element tag, <xsl:stylesheet>, and close with the corresponding tag, </xsl:stylesheet>. Within the opening tag, the XSL namespace must be defined:

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

After the root element, you can import external stylesheets with <xsl:import> elements, which must always be first within the <xsl:stylesheet> element. Any other elements can then be used in any order and in multiple occurrences if needed.


Team-Fly    
Top


Webmaster in a Nutshell
Webmaster in a Nutshell, Third Edition
ISBN: 0596003579
EAN: 2147483647
Year: 2002
Pages: 412

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