The Top Level entity defines the elements that can occur within the Stylesheet (or Transform) element. It forces all Import elements to appear first (if any occur at all), and then allows any mixture of other allowed elements:
<!ENTITY % top-level "
(xsl:import*,
(xsl:include | xsl:strip-space |
xsl:preserve-space | xsl:output |
xsl:key | xsl:decimal-format |
xsl:attribute-set | xsl:variable |
xsl:param | xsl:template |
xsl:namespace-alias
%non-xsl-top-level;)*) ">
Note that the Template and Variable elements shown in this list are described in the next section. The other elements are described below.
A mechanism for adding non-XSLT elements to this group is provided by the entity reference at the end. But the Non-XSL Top Level entity is initially empty:
<!ENTITY % non-xsl-top-level " " >
The Top Level entity is referenced from two places, namely from the Stylesheet element definition and from the Transform element definition:
<!ELEMENT xsl:stylesheet %top-level;> <!ELEMENT xsl:transform %top-level;>
For example:
<xsl:stylesheet ...> <xsl:import .../> <xsl:import .../> <xsl:template ...>...</xsl:template> <xsl:template ...>...</xsl:template> </xsl:stylesheet>
There are also a number of attributes that these two elements can take, and these are grouped within the Top Level Attributes entity:
<!ENTITY % top-level-atts " extension-element-prefixes CDATA #IMPLIED exclude-result-prefixes CDATA #IMPLIED id ID #IMPLIED version NMTOKEN #REQUIRED xmlns:xsl CDATA #FIXED "http://www.w3.org/1999/XSL/Transform" %space-att; <!ATTLIST xsl:stylesheet %top-level-atts;> <!ATTLIST xsl:transform %top-level-atts;>
The Import element is defined as follows:
<!ELEMENT xsl:import EMPTY >
The attributes are as follows:
<!ATTLIST xsl:import href %URI; #REQUIRED >
With the entity replaced, the true model is as follows:
<!ATTLIST xsl:import href CDATA #REQUIRED >
For example:
<xsl:import href="./library/styleTables.xsl" />
The Include element is defined as follows:
<!ELEMENT xsl:include EMPTY >
The attributes are as follows:
<!ATTLIST xsl:include href %URI; #REQUIRED >
With the entity replaced, the true model is as follows:
<!ATTLIST xsl:include href CDATA #REQUIRED >
For example:
<xsl:include href="commonStyles.xsl" />
The Strip Space element is defined as follows:
<!ELEMENT xsl:strip-space EMPTY >
The attributes are as follows:
<!ATTLIST xsl:strip-space elements CDATA #REQUIRED >
For example:
<xsl:strip-space elements="book title para" />
The Preserve Space element is defined as follows:
<!ELEMENT xsl:preserve-space EMPTY >
The attributes are as follows:
<!ATTLIST xsl:preserve-space elements CDATA #REQUIRED >
For example:
<xsl:preserve-space elements="example preformatted" />
The Output element is defined as follows:
<!ELEMENT xsl:output EMPTY >
The attributes are as follows:
<!ATTLIST xsl:output method %qname; #IMPLIED version NMTOKEN #IMPLIED encoding CDATA #IMPLIED omit-xml-declaration (yes|no) #IMPLIED standalone (yes|no) #IMPLIED doctype-public CDATA #IMPLIED doctype-system CDATA #IMPLIED cdata-section-elements %qnames; #IMPLIED indent (yes|no) #IMPLIED media-type CDATA #IMPLIED >
With all the embedded entity references replaced, the true model is as follows:
<!ATTLIST xsl:output method NMTOKEN #IMPLIED version NMTOKEN #IMPLIED encoding CDATA #IMPLIED omit-xml-declaration (yes|no) #IMPLIED standalone (yes|no) #IMPLIED doctype-public CDATA #IMPLIED doctype-system CDATA #IMPLIED cdata-section-elements NMTOKENS #IMPLIED indent (yes|no) #IMPLIED media-type CDATA #IMPLIED >
For example:
<xsl:output method="HTML" version="4.0" />
The Key element is defined as follows:
<!ELEMENT xsl:key EMPTY >
The attributes are as follows:
<!ATTLIST xsl:key name %qname; #IMPLIED match %pattern; #IMPLIED use %expr; #IMPLIED >
With all the embedded entity references replaced, the true model is as follows:
<!ATTLIST xsl:key name NMTOKEN #IMPLIED match CDATA #IMPLIED use CDATA #IMPLIED >
For example:
<xsl:key name="nameKey" match="name" use="name/first"/>
The Decimal Format element is defined as follows:
<!ELEMENT xsl:decimal-format EMPTY >
The attributes are as follows:
<!ATTLIST xsl:decimal-format name %qname; #IMPLIED decimal-separator %char; "." grouping-separator %char; "," infinity CDATA "infinity" minus-sign %char; "-" NaN CDATA "NaN" percent %char; "%" per-mille %char; "‰" zero-digit %char; "0" digit %char; "#" pattern-separator %char; ";" >
With all the embedded entity references replaced, the true model is as follows:
<!ATTLIST xsl:decimal-format name NMTOKEN #IMPLIED decimal-separator CDATA "." grouping-separator CDATA "," infinity CDATA "infinity" minus-sign CDATA "-" NaN CDATA "NaN" percent CDATA "%" per-mille CDATA "‰" zero-digit CDATA "0" digit CDATA "#" pattern-separator CDATA ";" >
The Attribute Set element is defined as follows:
<!ELEMENT xsl:attribute-set (xsl:attribute)* >
The attributes are as follows:
<!ATTLIST xsl:attribute-set name %qname; #REQUIRED use-attribute-sets %qnames; #IMPLIED >
With all the embedded entity references replaced, the true model is as follows:
<!ATTLIST xsl:attribute-set name NMTOKEN #REQUIRED use-attribute-sets NMTOKENS #IMPLIED >
For example:
<xsl:attribute-set name="standardSet" > <xsl:attribute...></xsl:attribute> <xsl:attribute...></xsl:attribute> <xsl:attribute...></xsl:attribute> </xsl:attribute-set>
The Parameter element is defined as follows:
<!ELEMENT xsl:param %template; >
This expands to the following:
<!ELEMENT xsl:param ( #PCDATA | xsl:apply-templates | xsl:call-template | xsl:apply-imports | xsl:for-each | xsl:value-of | xsl:copy-of | xsl:number | xsl:choose | xslif | xsl:text | xsl:copy | xsl:variable | xsl:message | xsl:fallback | xsl:processing-instruction | xsl:comment | xsl:element | xsl:attribute )* >
The attributes are as follows:
<!ATTLIST xsl:attribute-set name %qname; #REQUIRED select %expr; #IMPLIED >
With the embedded entity references replaced, the true model is as follows:
<!ATTLIST xsl:attribute-set name NMTOKEN #REQUIRED select CDATA #IMPLIED >
The Namespace Alias element is defined as follows:
<!ELEMENT xsl:namespace-alias EMPTY >
The attributes are as follows:
<!ATTLIST xsl:namespace-alias stylesheet-prefix CDATA #REQUIRED result-prefix CDATA #REQUIRED >