Comments on this specification may be sent to xsl-editors@w3.org.
Added text marked thus. Removed text marked thus. Changed text marked thus.
Section 1, first paragraph.
This specification defines the syntax and semantics of the XSLT language. A transformation in the XSLT language is expressed as a well-formed XML document [XML] or [XML 1.1] conforming to the Namespaces in XML Recommendation [XML Names] or [XML Names 1.1], which may include both elements that are defined by XSLT and elements that are not defined by XSLT. For convenience, XML 1.0 and XML Names 1.0 references are usually used. Thus, URI references are also used though IRI may also be supported. In some cases, the XML 1.0 and XML 1.1 definitions may be exactly the same.
Section 3.5, new section.
The data model is capable of representing either an XML 1.0 document (conforming to [XML] and [XML Names]) or an XML 1.1 document (conforming to [XML 1.1] and [XML Names 1.1]), and it makes no distinction between the two. In principle, therefore, XSLT 1.0 can be used with either of these XML versions; the only differences arise outside the boundary of the transformation proper, either while creating the data model from textual XML (parsing), or while producing textual XML from the data model (serialization).
Construction of the data model is outside the scope of this specification, so XSLT 1.0 places no formal requirements on an XSLT processor to accept input from either XML 1.0 documents or XML 1.1 documents or both. This specification defines capability to output XML 1.0 or XML 1.1 documents (16 Output). There is again no formal requirement on an XSLT processor to support either or both of these XML versions.
Because the data model is the same whether the original document was XML 1.0 or XML 1.1, the semantics of XSLT processing do not depend on the version of XML used by the original document. There is no reason in principle why all the input and output documents used in a single transformation must conform to the same version of XML.
Section 11.5, first paragraph.
As well as being allowed at the top-level, both
xsl:variable
andxsl:param
are also allowed in templates.xsl:variable
is allowed anywhere within a template that an instruction is allowed. In this case, the binding is visible for all following siblings and their descendants.the descendants of all following siblings that are notxsl:fallback
instructions. Note that the binding is not visible for thexsl:variable
element itself.xsl:param
is allowed as a child at the beginning of anxsl:template
element. In this context, the binding is visible for all following siblings and their descendants.the descendants of all following siblings that are notxsl:fallback
instructions. Note that the binding is not visible for thexsl:param
element itself.
Section 16.1, first paragraph.
<?xml version="xml-version"?> <!DOCTYPE doc [ <!ENTITY e SYSTEM "entity-URI"> ]> <doc>&e;</doc>where
entity-URI
is a URI for the entity andxml-version
corresponds to the XML version of the entity, then the wrapper document as a whole should be a well-formed XML document conforming to the XML Namespaces Recommendation [XML Names]. either to [XML Names] or [XML Names 1.1].Section 16.1, fourth paragraph.
The
version
attribute specifies the version of XML to be used for outputting the result tree. If the XSLT processor does not support this version of XML, it should use a version of XML that it does support. The version output in the XML declaration (if an XML declaration is output) should correspond to the version of XML that the processor used for outputting the result tree. The value of theversion
attribute should match the VersionNum production of the XML Recommendation [XML]. The default value is1.0
.The default value is 1.0. If the value is 1.1 and the XSLT processor does support XML 1.1 and XML Names 1.1, then the following restrictions apply:
Undeclaring prefixes must not occur.
Unicode normalization must not occur.
Section 16.1, fifth paragraph.
The
encoding
attribute specifies the preferred encoding to use for outputting the result tree. XSLT processors are required to respect values ofUTF-8
andUTF-16
. For other values, if the XSLT processor does not support the specified encoding it may signal an error; if it does not signal an error it should useUTF-8
orUTF-16
instead. The XSLT processor must not use an encoding whose name does not match the EncName production of the XML Recommendation [XML] or [XML 1.1]. If noencoding
attribute is specified, then the XSLT processor should use eitherUTF-8
orUTF-16
.
Section A.1, Add the following references:
World Wide Web Consortium. Extensible Markup Language (XML) 1.1. W3C Recommendation. See http://www.w3.org/TR/xml11/
World Wide Web Consortium. Namespaces in XML 1.1. W3C Recommendation. See http://www.w3.org/TR/xml-names11/
Section 2.1, second paragraph.
Elements from the XSLT namespace are recognized only in the stylesheet and not in the source document.
Section 2.5, first paragraph. Spurious reference to literal result element as stylesheet without
xsl:version
attribute. See http://lists.w3.org/Archives/Public/xsl-editors/1999OctDec/0035.html.An element enables forwards-compatible mode for itself, its attributes, its descendants and their attributes if either it is an
xsl:stylesheet
element whoseversion
attribute is not equal to1.0
, or it is a literal result element that has anxsl:version
attribute whose value is not equal to1.0
, or it is a literal result element that does not have anxsl:version
attribute and that is the document element of a stylesheet using the simplified syntax (see [2.3 Literal Result Element as Stylesheet]). A literal result element that has anxsl:version
attribute whose value is equal to1.0
disables forwards-compatible mode for itself, its attributes, its descendants and their attributes.
Section 2.5, first note.
NOTE: If a stylesheet depends crucially on a top-level element introduced by a version of XSLT after 1.0, then the stylesheet can use an
xsl:message
element withterminate="yes"
(see [13 Messages]) to ensure that XSLT processors implementing earlier versions of XSLT will not silently ignore the top-level element. For example,
Section 2.7, final note.
NOTE:A stylesheet that is embedded in the document to which it is to be applied or that may be included or imported into an stylesheet that is so embedded typically needs to contain a template rule that specifies that
xsl:stylesheet
elements are to be ignored.
Section 3.4, paragraph 6. Description of
xsl:strip-space
andxsl:preserve-space
is unclear, see http://lists.w3.org/Archives/Public/xsl-editors/1999OctDec/0083.html.For source documents, the set of whitespace-preserving element names is specified by
xsl:strip-space
andxsl:preserve-space
top-level elements. Whether an element name is included in the set of whitespace-preserving names is determined by the best match amongstxsl:strip-space
orxsl:preserve-space
elements: it is included if and only if there is no match or the best match is anxsl:preserve-space
element. These Thexsl:strip-space
andxsl:preserve-space
elements each have anelements
attribute whose value is a whitespace-separated list of NameTests; an element name matches anxsl:strip-space
orxsl:preserve-space
element if it matches one of the NameTests. An element matches a NameTest if and only if the NameTest would be true for the element as an XPath node test. When more than onexsl:strip-space
andxsl:preserve-space
element matches, the best matching element is determined by the best matching NameTest. This is determined in the same way as with template rules:
First, any match with lower import precedence than another match is ignored.
Next, any match with a NameTest that has a lower default priority than the default priority of the NameTest of another match is ignored.
Section 5.2, fourteenth bullet.
items/item[position()>1]
matches anyitem
element that has anitems
parent and that is not the firstitem
child of its parent
Section 7.1.2, second paragraph.
An XSLT processor may signal the error; if it does not signal the error, then it must recover by making the the result of instantiating the
xsl:element
element be the sequence of nodes created by instantiating the content of thexsl:element
element, excluding any initial attribute nodes.
Section 7.1.3, third bullet. Recovery behavior for element nodes in instantiated content of
xsl:attribute
is unclear. See http://lists.w3.org/Archives/Member/w3c-xsl-wg/2000May/0092.html (members only).
- Creating nodes other than text nodes during the instantiation of the content of the
xsl:attribute
element; implementations may either signal the error or ignore the offending nodes together with their content.
Section 7.1.4, last paragraph. Interaction of
use-attribute-sets
andxsl:import
is unspecified. See http://lists.w3.org/Archives/Member/w3c-xsl-wg/2000Jun/0057.html (members only) and http://lists.w3.org/Archives/Public/xsl-editors/2000JulSep/0095.html.Multiple definitions of an attribute set with the same expanded-name are merged. An attribute from a definition that has higher import precedence takes precedence over an attribute from a definition that has lower import precedence. It is an error if there are two attribute sets that have the same expanded-name and equal import precedence and that both contain the same attribute, unless there is a definition of the attribute set with higher import precedence that also contains the attribute. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing from amongst the definitions that specify the attribute that have the highest import precedence the one that was specified last in the stylesheet. Where the attributes in an attribute set were specified is relevant only in merging the attributes into the attribute set; it makes no difference when the attribute set is used. For each attribute set name occurring in a
use-attribute-sets
attribute on anxsl:attribute-set
element, all definitions of an attribute set with that name must be merged before theuse-attribute-sets
attribute is replaced by the equivalent sequence ofxsl:attribute
child elements. Anyuse-attribute-sets
attribute on anxsl:attribute-set
element must be replaced by the equivalent sequence ofxsl:attribute
child elements before thatxsl:attribute-set
element is merged with otherxsl:attribute-set
elements with the same expanded-name. Whenxsl:attribute-set
elements with the same expanded-name are merged, anyxsl:attribute
child elements added to replace ause-attribute-sets
attribute are treated exactly as if they had originally been specified in the stylesheet as child elements.
Section 7.5. Behavior when copying a namespace node is unspecified. See http://lists.w3.org/Archives/Public/xsl-editors/2000JulSep/0095.html.
Add the following paragraph before the final paragraph of the section:
When the current node is a namespace node, then copying it adds a namespace node to the containing node in the result tree. It is an error if this containing node is not an element; implementations may either signal the error or ignore the namespace node. It is an error to add a namespace node to an element after children have been added to it or after attributes have been added to it; implementations may either signal an error or ignore the namespace node. It is an error to add a namespace node to an element if the element already has a namespace node with the same name, unless both namespace nodes have the same string-value, in which case the duplicate is ignored. It is an error to add a namespace node to an element if the namespace node has a null name and the element has a null namespace URI.
[Section 11.3, first paragraph] The
xsl:copy-of
element can be used to insert a result tree fragment into the result tree, without first converting it to a string asxsl:value-of
does (see [7.6.1 Generating Text withxsl:value-of
]). The requiredselect
attribute contains an expression. When the result of evaluating the expression is a result tree fragment, the complete fragment is copied into the result tree. When the result is a node-set, all the nodes in the set are copied in document order into the result tree; copying an element node copies the attribute nodes, namespace nodes and children of the element node as well as the element node itself; a root node is copied by copying its children. For copying an attribute or namespace node, the same rules apply as withxsl:copy
(see [7.5 Copying]). When the result is neither a node-set nor a result tree fragment, the result is converted to a string and then inserted into the result tree, as withxsl:value-of
.
Section 7.7, first paragraph. Behavior unspecified when an expression specified by a
value
attribute onxsl:number
evaluates to a numeric value that after rounding is not a strictly positive integer. See http://lists.w3.org/Archives/Public/xsl-editors/2000JulSep/0057.html.The
xsl:number
element is used to insert a formatted number into the result tree. The number to be inserted may be specified by an expression. Thevalue
attribute contains an expression. The expression is evaluated and the resulting object is converted to a number as if by a call to the number function. It is an error if the number is NaN, infinite or less than 0.5; an XSLT processor may signal the error; if it does not signal the error, it must recover by converting the number to a string as if by a call to the string function and inserting the resulting string into the result tree. Otherwise, tThe number is rounded to an integer and then converted to a string using the attributes specified in [7.7.1 Number to String Conversion Attributes]; in this context, the value of each of these attributes is interpreted as an attribute value template. After conversion, the resulting string is inserted in the result tree. For example, the following example numbers a sorted list:
Section 7.7, sixth bullet. Behavior unspecified when
xsl:number level="any"
and there are no matching nodes. See http://lists.w3.org/Archives/Member/w3c-xsl-wg/2000Apr/0017.html (members only).
- When
level="any"
, it constructs a list of length one containing the number of nodes that match thecount
pattern and belong to the set containing the current node and all nodes at any level of the document that are before the current node in document order, excluding any namespace and attribute nodes (in other words the union of the members of thepreceding
andancestor-or-self
axes). If there are no matching nodes, it constructs an empty list. If thefrom
attribute is specified, then only nodes after the first node before the current node that match thefrom
pattern are considered.
Section 10, first paragraph.
When a template is instantiated by
xsl:apply-templates
andxsl:for-each
, the current node list list consists of the complete list of nodes being processed in sorted order.
Section 10, second paragraph. See http://lists.w3.org/Archives/Member/w3c-xsl-wg/2000Jul/0004.html (members only).
For each node to be processed, the expression is evaluated with that node as the current node and with the complete list of nodes being processed in document order as the current node list.
Section 10, fifth bullet. Behavior unspecified when sorting
NaN
withdata-type="number"
. See http://lists.w3.org/Archives/Member/w3c-xsl-wg/2000Jun/0057.html (members only).
number
specifies that the sort keys should be converted to numbers and then sorted according to the numeric value; the sort key is converted to a number as if by a call to the number function; thelang
attribute is ignored; in ascending order a NaN precedes all other numeric values and in descending order it follows them
Section 10, seventh bullet. Interaction of case order and sorting direction underspecified. See http://lists.w3.org/Archives/Member/w3c-xsl-wg/2000Jul/0004.html (members only).
case-order
has the valueupper-first
orlower-first
; this applies whendata-type="text"
, and specifies that in ascending order upper-case letters should sort before lower-case letters or vice-versa respectively. For example, iflang="en"
, thenA a B b
are sorted in ascending order withcase-order="upper-first"
anda A b B
are sorted in ascending order withcase-order="lower-first"
. In descending order, the effect is reversed. For example, iflang="en"
, thenb B a A
are sorted in descending order withcase-order="upper-first"
. The default value is language dependent.
Section 11, last paragraph. Description of shadowed variables is overly general given the prohibition on local variables shadowing other local variables. See http://lists.w3.org/Archives/Public/xsl-editors/1999OctDec/0082.html.
For any use of these variable-binding elements, there is a region of the stylesheet tree within which the binding is visible; within this region, any binding of the variable that was visible on the variable-binding element itself is hidden. Thus, only the innermost binding of a variable is visible. The set of variable bindings in scope for an expression consists of those bindings that are visible at the point in the stylesheet where the expression occurs.
[Section 11.4, first paragraph.] Both
xsl:variable
andxsl:param
are allowed as top-level elements. A top-level variable-binding element declares a global variable that is visible everywhere (except where it is shadowed by another binding).[Section 11.5, second paragraph.] A binding shadows another binding if the binding occurs at a point where the other binding is visible, and the bindings have the same name. It is an error if a binding established by an
xsl:variable
orxsl:param
element within a template shadows another binding established by anxsl:variable
orxsl:param
element also within the template. It is not an error if a binding established by anxsl:variable
orxsl:param
element in a template shadows another binding established by anxsl:variable
orxsl:param
top-level element. In this case, the top-level binding will not be visible in the region of the stylesheet where it is shadowed by the other binding. Thus, the following is an error:
Section 11.4, first paragraph. Behavior of multiple top-level variables with the same name and different import precedences is unspecified. See http://lists.w3.org/Archives/Public/xsl-editors/1999OctDec/0082.html.
... A top-level
xsl:param
element declares a parameter to the stylesheet; XSLT does not define the mechanism by which parameters are passed to the stylesheet. If a stylesheet contains more than one binding for a variable of a particular name, then the binding with the highest import precedence is used. It is an error if a stylesheet contains more than one binding of a top-level variable with the same name and same import precedence.
Section 11.6, first paragraph. Behavior of
xsl:with-param
elements with the samename
is unspecified. See http://lists.w3.org/Archives/Public/xsl-editors/2000AprJun/0088.html.Parameters are passed to templates using the
xsl:with-param
element. The requiredname
attribute specifies the name of the parameter (the variable the value of whose binding is to be replaced). The value of thename
attribute is a QName, which is expanded as described in [2.4 Qualified Names].xsl:with-param
is allowed within bothxsl:call-template
andxsl:apply-templates
. It is an error if a singlexsl:call-template
orxsl:apply-templates
element contains more than onexsl:with-param
element with the same name. The value of the parameter is specified in the same way as forxsl:variable
andxsl:param
. The current node and current node list used for computing the value specified byxsl:with-param
element is the same as that used for thexsl:apply-templates
orxsl:call-template
element within which it occurs. It is not an error to pass a parameter x to a template that does not have anxsl:param
element for x; the parameter is simply ignored.
Section 12.1, fourth paragraph.
The semantics of the fragment identifier are dependent on the media type of the result of retrieving the URI.
Section 12.1, sixth paragraph. Behavior unspecified when the
document
function is called with an empty nodeset as a second argument. See http://lists.w3.org/Archives/Public/xsl-editors/2000JulSep/0095.html.The URI reference may be relative. The base URI (see [3.2 Base URI]) of the node in the second argument node-set that is first in document order is used as the base URI for resolving the relative URI into an absolute URI. It is an error if the second argument node-set is empty and the URI reference is relative; the XSLT processor may signal the error; if it does not signal an error, it must recover by returning an empty node-set. If the second argument is omitted, then it defaults to the node in the stylesheet that contains the expression that includes the call to the document function.
Section 12.2, eighth paragraph. Calls to the
key
function inmatch
anduse
attributes onxsl:key
elements may cause cycles. See http://lists.w3.org/Archives/Member/w3c-xsl-wg/2000Jun/0048.html (members only).It is an error for the value of either the
use
attribute or thematch
attribute to contain a VariableReference, or a call to the key function.
Section 12.2, ninth paragraph.
When the second argument to the key function is of type node-set, then the result is the union of the result of applying the key function to the string-value of each of the nodes in the argument node-set.
Section 12.2, next-to-last paragraph. Text introducing example is confusing. See http://lists.w3.org/Archives/Member/w3c-xsl-wg/2000Jul/0008.html (members only).
The key always returns nodes that are in the same document as the current node; to retrieve a key from any other document, it is necessary first to change the current node. For example, suppose a document contains bibliographic references in the form
<bibref>XSLT</bibref>
, and there is a separate XML documentbib.xml
containing a bibliographic database with entries in the form:
Section 12.3, second paragraph. Behaviour of the
format-number
function in the absence of anxsl:decimal-format
element is unspecified. See http://lists.w3.org/Archives/Member/w3c-xsl-wg/2000Jun/0057.html (members only).The
xsl:decimal-format
element declares a decimal-format, which controls the interpretation of a format pattern used by the format-number function. If there is aname
attribute, then the element declares a named decimal-format; otherwise, it declares the default decimal-format. The value of thename
attribute is a QName, which is expanded as described in [2.4 Qualified Names]. It is an error to declare either the default decimal-format or a decimal-format with a given name more than once (even with different import precedence), unless it is declared every time with the same value for all attributes (taking into account any default values). If a stylesheet does not contain a declaration of the default decimal format, a declaration equivalent to anxsl:decimal-format
element with no attributes is implied.
Section 12.4. Restrictions on system properties in the XSLT namespace unclear. See http://lists.w3.org/Archives/Public/xsl-editors/2000JulSep/0095.html.
Add the following paragraph at the end of the section:
Vendors must not define additional system properties in the XSLT namespace.
Section 13, final example.
<xsl:param name="lang" select="'en'"/>
Section 15, third paragraph. Interaction of a default namespace with the
element-available
function is unspecified. See http://lists.w3.org/Archives/Public/xsl-editors/1999OctDec/0039.html.The argument must evaluate to a string that is a QName. The QName is expanded into an expanded-name using the namespace declarations in scope for the expression. If there is a default namespace in scope, then it is used to expand an unprefixed QName. The element-available function returns true if and only if the expanded-name is the name of an instruction. If the expanded-name has a namespace URI equal to the XSLT namespace URI, then it refers to an element defined by XSLT. Otherwise, it refers to an extension element. If the expanded-name has a null namespace URI, the element-available function will return false.
Section 16.1, first bullet. Serialization need not preserve ordering of namespace nodes. See http://lists.w3.org/Archives/Public/xsl-editors/2000AprJun/0086.html.
- The order of attribute and namespace nodes in the two trees may be different.
Section 16.1 Serialization cannot preserve base URIs.
Add the following text as a third bullet:
The base URIs of nodes in the two trees may be different.
Section 16.1, second paragraph. If the output includes a standalone document declaration or document type declaration, then it must be an XML document and not merely an external general parsed entity. See http://lists.w3.org/Archives/Public/xsl-editors/1999OctDec/0074.html.
If the XSLT processor generated a document type declaration because of the
doctype-system
attribute or generated a standalone document declaration because of thestandalone
attribute, then the output must be a well-formed XML document, and the above requirements apply to the tree constructed by parsing that document directly, without any wrapper, using an XML processor that does not process the DTD.NOTE:Processing the DTD might cause additional attributes to appear in the tree because of attribute defaulting.
Section 16.1, tenth paragraph.
Otherwise, it should not include a standalone document declaration; this ensures that it is both an XML declaration (allowed at the beginning of a document entity) and a text declaration (allowed at the beginning of an external general parsed entity).
Section 16.4 Interaction of
disable-output-escaping
and result tree fragments unspecified. See http://lists.w3.org/Archives/Member/w3c-xsl-wg/2000Apr/0061.html (members only) and http://lists.w3.org/Archives/Member/w3c-xsl-wg/2000May/0066.html (members only).Add the following text after the second paragraph:
When a root node is copied using an
xsl:copy-of
element (see [11.3 Using Values of Variables and Parameters withxsl:copy-of
]) and escaping was disabled for a text node descendant of that root node, then escaping should also be disabled for the resulting copy of that text node. For example<xsl:variable name="x"> <xsl:text disable-output-escaping="yes"><</xsl:text> </xsl:variable> <xsl:copy-of select="$x"/>should output
<
not<
.
Appendix E. Add "Boris Moore, RivCom" to the list of XSL WG members.