Copyright © 1999 W3C® (MIT, INRIA, Keio), All Rights Reserved. W3C liability, trademark, document use, and software licensing rules apply.
This specification defines the syntax and semantics of XSLT, which is a language for transforming XML documents into other XML documents.
XSLT is designed for use as part of XSL, which is a stylesheet language for XML. In addition to XSLT, XSL includes an XML vocabulary for specifying formatting. XSL specifies the styling of an XML document by using XSLT to describe how the document is transformed into another XML document that uses the formatting vocabulary.
XSLT is also designed to be used independently of XSL. However, XSLT is not intended as a completely general-purpose XML transformation language. Rather it is designed primarily for the kinds of transformations that are needed when XSLT is used as part of XSL.
This document has been reviewed by W3C Members and other interested parties and has been endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited as a normative reference from other documents. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.
The list of known errors in this specification is available at http://www.w3.org/1999/11/REC-xslt-19991116-errata.
Comments on this specification may be sent to xsl-editors@w3.org; archives of the comments are available. Public discussion of XSL, including XSL Transformations, takes place on the XSL-List mailing list.
The English version of this specification is the only normative version. However, for translations of this document, see http://www.w3.org/Style/XSL/translations.html.
A list of current W3C Recommendations and other technical documents can be found at http://www.w3.org/TR.
This specification has been produced as part of the W3C Style activity.
1 Introduction
2 Stylesheet Structure
2.1 XSLT Namespace
2.2 Stylesheet Element
2.3 Literal Result Element as Stylesheet
2.4 Qualified Names
2.5 Forwards-Compatible Processing
2.6 Combining Stylesheets
2.6.1 Stylesheet Inclusion
2.6.2 Stylesheet Import
2.7 Embedding Stylesheets
3 Data Model
3.1 Root Node Children
3.2 Base URI
3.3 Unparsed Entities
3.4 Whitespace Stripping
4 Expressions
5 Template Rules
5.1 Processing Model
5.2 Patterns
5.3 Defining Template Rules
5.4 Applying Template Rules
5.5 Conflict Resolution for Template Rules
5.6 Overriding Template Rules
5.7 Modes
5.8 Built-in Template Rules
6 Named Templates
7 Creating the Result Tree
7.1 Creating Elements and Attributes
7.1.1 Literal Result Elements
7.1.2 Creating Elements with xsl:element
7.1.3 Creating Attributes with xsl:attribute
7.1.4 Named Attribute Sets
7.2 Creating Text
7.3 Creating Processing Instructions
7.4 Creating Comments
7.5 Copying
7.6 Computing Generated Text
7.6.1 Generating Text with xsl:value-of
7.6.2 Attribute Value Templates
7.7 Numbering
7.7.1 Number to String Conversion Attributes
8 Repetition
9 Conditional Processing
9.1 Conditional Processing with xsl:if
9.2 Conditional Processing with xsl:choose
10 Sorting
11 Variables and Parameters
11.1 Result Tree Fragments
11.2 Values of Variables and Parameters
11.3 Using Values of Variables and Parameters with
xsl:copy-of
11.4 Top-level Variables and Parameters
11.5 Variables and Parameters within Templates
11.6 Passing Parameters to Templates
12 Additional Functions
12.1 Multiple Source Documents
12.2 Keys
12.3 Number Formatting
12.4 Miscellaneous Additional Functions
13 Messages
14 Extensions
14.1 Extension Elements
14.2 Extension Functions
15 Fallback
16 Output
16.1 XML Output Method
16.2 HTML Output Method
16.3 Text Output Method
16.4 Disabling Output Escaping
17 Conformance
18 Notation
A References
A.1 Normative References
A.2 Other References
B Element Syntax Summary
C DTD Fragment for XSLT Stylesheets (Non-Normative)
D Examples (Non-Normative)
D.1 Document Example
D.2 Data Example
E Acknowledgements (Non-Normative)
F Changes from Proposed Recommendation (Non-Normative)
G Features under Consideration for Future Versions of XSLT (Non-Normative)
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] conforming to the Namespaces in XML Recommendation [XML Names], which may include both elements that are defined by XSLT and elements that are not defined by XSLT. [Definition: XSLT-defined elements are distinguished by belonging to a specific XML namespace (see 2.1 XSLT Namespace), which is referred to in this specification as the XSLT namespace.] Thus this specification is a definition of the syntax and semantics of the XSLT namespace.
A transformation expressed in XSLT describes rules for transforming a source tree into a result tree. The transformation is achieved by associating patterns with templates. A pattern is matched against elements in the source tree. A template is instantiated to create part of the result tree. The result tree is separate from the source tree. The structure of the result tree can be completely different from the structure of the source tree. In constructing the result tree, elements from the source tree can be filtered and reordered, and arbitrary structure can be added.
A transformation expressed in XSLT is called a stylesheet. This is because, in the case when XSLT is transforming into the XSL formatting vocabulary, the transformation functions as a stylesheet.
This document does not specify how an XSLT stylesheet is associated with an XML document. It is recommended that XSL processors support the mechanism described in [XML Stylesheet]. When this or any other mechanism yields a sequence of more than one XSLT stylesheet to be applied simultaneously to a XML document, then the effect should be the same as applying a single stylesheet that imports each member of the sequence in order (see 2.6.2 Stylesheet Import).
A stylesheet contains a set of template rules. A template rule has two parts: a pattern which is matched against nodes in the source tree and a template which can be instantiated to form part of the result tree. This allows a stylesheet to be applicable to a wide class of documents that have similar source tree structures.
A template is instantiated for a particular source element to create part of the result tree. A template can contain elements that specify literal result element structure. A template can also contain elements from the XSLT namespace that are instructions for creating result tree fragments. When a template is instantiated, each instruction is executed and replaced by the result tree fragment that it creates. Instructions can select and process descendant source elements. Processing a descendant element creates a result tree fragment by finding the applicable template rule and instantiating its template. Note that elements are only processed when they have been selected by the execution of an instruction. The result tree is constructed by finding the template rule for the root node and instantiating its template.
In the process of finding the applicable template rule, more than one template rule may have a pattern that matches a given element. However, only one template rule will be applied. The method for deciding which template rule to apply is described in 5.5 Conflict Resolution for Template Rules.
A single template by itself has considerable power: it can create structures of arbitrary complexity; it can pull string values out of arbitrary locations in the source tree; it can generate structures that are repeated according to the occurrence of elements in the source tree. For simple transformations where the structure of the result tree is independent of the structure of the source tree, a stylesheet can often consist of only a single template, which functions as a template for the complete result tree. Transformations on XML documents that represent data are often of this kind (see D.2 Data Example). XSLT allows a simplified syntax for such stylesheets (see 2.3 Literal Result Element as Stylesheet).
When a template is instantiated, it is always instantiated with respect to a [Definition: current node] and a [Definition: current node list]. The current node is always a member of the current node list. Many operations in XSLT are relative to the current node. Only a few instructions change the current node list or the current node (see 5 Template Rules and 8 Repetition); during the instantiation of one of these instructions, the current node list changes to a new list of nodes and each member of this new list becomes the current node in turn; after the instantiation of the instruction is complete, the current node and current node list revert to what they were before the instruction was instantiated.
XSLT makes use of the expression language defined by [XPath] for selecting elements for processing, for conditional processing and for generating text.
XSLT provides two "hooks" for extending the language, one hook for extending the set of instruction elements used in templates and one hook for extending the set of functions used in XPath expressions. These hooks are both based on XML namespaces. This version of XSLT does not define a mechanism for implementing the hooks. See 14 Extensions.
Note:
The XSL WG intends to define such a mechanism in a future version of this specification or in a separate specification.
The element syntax summary notation used to describe the syntax of XSLT-defined elements is described in 18 Notation.
The MIME media types text/xml and
application/xml [RFC2376] should be used
for XSLT stylesheets. It is possible that a media type will be
registered specifically for XSLT stylesheets; if and when it is, that
media type may also be used.
The XSLT namespace has the URI http://www.w3.org/1999/XSL/Transform.
Note:
The 1999 in the URI indicates the year in which
the URI was allocated by the W3C. It does not indicate the version of
XSLT being used, which is specified by attributes (see 2.2 Stylesheet Element and 2.3 Literal Result Element as Stylesheet).
XSLT processors must use the XML namespaces mechanism [XML Names] to recognize elements and attributes from this namespace. Elements from the XSLT namespace are recognized only in the stylesheet not in the source document. The complete list of XSLT-defined elements is specified in B Element Syntax Summary. Vendors must not extend the XSLT namespace with additional elements or attributes. Instead, any extension must be in a separate namespace. Any namespace that is used for additional instruction elements must be identified by means of the extension element mechanism specified in 14.1 Extension Elements.
This specification uses a prefix of xsl: for referring
to elements in the XSLT namespace. However, XSLT stylesheets are free
to use any prefix, provided that there is a namespace declaration that
binds the prefix to the URI of the XSLT namespace.
An element from the XSLT namespace may have any attribute not from the XSLT namespace, provided that the expanded-name of the attribute has a non-null namespace URI. The presence of such attributes must not change the behavior of XSLT elements and functions defined in this document. Thus, an XSLT processor is always free to ignore such attributes, and must ignore such attributes without giving an error if it does not recognize the namespace URI. Such attributes can provide, for example, unique identifiers, optimization hints, or documentation.
It is an error for an element from the XSLT namespace to have attributes with expanded-names that have null namespace URIs (i.e. attributes with unprefixed names) other than attributes defined for the element in this document.
Note:
The conventions used for the names of XSLT elements, attributes and functions are that names are all lower-case, use hyphens to separate words, and use abbreviations only if they already appear in the syntax of a related language such as XML or HTML.
A stylesheet is represented by an xsl:stylesheet
element in an XML document. xsl:transform is allowed as
a synonym for xsl:stylesheet.
An xsl:stylesheet element must have a
version attribute, indicating the version of XSLT that
the stylesheet requires. For this version of XSLT, the value should
be 1.0. When the value is not equal to 1.0,
forwards-compatible processing mode is enabled (see 2.5 Forwards-Compatible Processing).
The xsl:stylesheet element may contain the following types
of elements:
xsl:import
xsl:include
xsl:strip-space
xsl:preserve-space
xsl:output
xsl:key
xsl:decimal-format
xsl:namespace-alias
xsl:attribute-set
xsl:variable
xsl:param
xsl:template
[Definition: An element occurring as
a child of an xsl:stylesheet element is called a
top-level element.]
This example shows the structure of a stylesheet. Ellipses
(...) indicate where attribute values or content have
been omitted. Although this example shows one of each type of allowed
element, stylesheets may contain zero or more of each of these
elements.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="..."/>
<xsl:include href="..."/>
<xsl:strip-space elements="..."/>
<xsl:preserve-space elements="..."/>
<xsl:output method="..."/>
<xsl:key name="..." match="..." use="..."/>
<xsl:decimal-format name="..."/>
<xsl:namespace-alias stylesheet-prefix="..." result-prefix="..."/>
<xsl:attribute-set name="...">
...
</xsl:attribute-set>
<xsl:variable name="...">...</xsl:variable>
<xsl:param name="...">...</xsl:param>
<xsl:template match="...">
...
</xsl:template>
<xsl:template name="...">
...
</xsl:template>
</xsl:stylesheet> |
The order in which the children of the xsl:stylesheet
element occur is not significant except for xsl:import
elements and for error recovery. Users are free to order the elements
as they prefer, and stylesheet creation tools need not provide control
over the order in which the elements occur.
In addition, the xsl:stylesheet element may contain
any element not from the XSLT namespace, provided that the
expanded-name of the element has a non-null namespace URI. The presence of
such top-level elements must not change the behavior of XSLT elements
and functions defined in this document; for example, it would not be
permitted for such a top-level element to specify that
xsl:apply-templates was to use different rules to resolve
conflicts. Thus, an XSLT processor is always free to ignore such
top-level elements, and must ignore a top-level element without giving
an error if it does not recognize the namespace URI. Such elements can
provide, for example,
information used by extension elements or extension functions (see 14 Extensions),
information about what to do with the result tree,
information about how to obtain the source tree,
metadata about the stylesheet,
structured documentation for the stylesheet.
A simplified syntax is allowed for stylesheets that consist of only
a single template for the root node. The stylesheet may consist of
just a literal result element (see 7.1.1 Literal Result Elements). Such a stylesheet is equivalent to a
stylesheet with an xsl:stylesheet element containing a
template rule containing the literal result element; the template rule
has a match pattern of /. For example
<html xsl:version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/xhtml1/strict">
<head>
<title>Expense Report Summary</title>
</head>
<body>
<p>Total Amount: <xsl:value-of select="expense-report/total"/></p>
</body>
</html> |
has the same meaning as
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/xhtml1/strict">
<xsl:template match="/">
<html>
<head>
<title>Expense Report Summary</title>
</head>
<body>
<p>Total Amount: <xsl:value-of select="expense-report/total"/></p>
</body>
</html>
</xsl:template>
</xsl:stylesheet> |
A literal result element that is the document element of a
stylesheet must have an xsl:version attribute, which
indicates the version of XSLT that the stylesheet requires. For this
version of XSLT, the value should be 1.0; the value must
be a Number. Other literal result
elements may also have an xsl:version attribute. When the
xsl:version attribute is not equal to 1.0,
forwards-compatible processing mode is enabled (see 2.5 Forwards-Compatible Processing).
The allowed content of a literal result element when used as a stylesheet is no different from when it occurs within a stylesheet. Thus, a literal result element used as a stylesheet cannot contain top-level elements.
In some situations, the only way that a system can recognize that an XML document needs to be processed by an XSLT processor as an XSLT stylesheet is by examining the XML document itself. Using the simplified syntax makes this harder.
Note:
For example, another XML language (AXL) might also use an
axl:version on the document element to indicate that an
XML document was an AXL document that required processing by an AXL
processor; if a document had both an axl:version
attribute and an xsl:version attribute, it would be
unclear whether the document should be processed by an XSLT processor
or an AXL processor.
Therefore, the simplified syntax should not be used for XSLT
stylesheets that may be used in such a situation. This situation can,
for example, arise when an XSLT stylesheet is transmitted as a message
with a MIME media type of text/xml or
application/xml to a recipient that will use the MIME
media type to determine how the message is processed.
The name of an internal XSLT object, specifically a named template (see 6 Named Templates), a mode (see 5.7 Modes), an attribute set (see 7.1.4 Named Attribute Sets), a key (see 12.2 Keys), a decimal-format (see 12.3 Number Formatting), a variable or a parameter (see 11 Variables and Parameters) is specified as a QName. If it has a prefix, then the prefix is expanded into a URI reference using the namespace declarations in effect on the attribute in which the name occurs. The expanded-name consisting of the local part of the name and the possibly null URI reference is used as the name of the object. The default namespace is not used for unprefixed names.
An element enables forwards-compatible mode for itself, its
attributes, its descendants and their attributes if either it is an
xsl:stylesheet element whose version
attribute is not equal to 1.0, or it is a literal result
element that has an xsl:version attribute whose value is
not equal to 1.0, or it is a literal result element that
does not have an xsl: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 an xsl:version attribute whose value is equal to
1.0 disables forwards-compatible mode for itself, its
attributes, its descendants and their attributes.
If an element is processed in forwards-compatible mode, then:
if it is a top-level element and XSLT 1.0 does not allow such elements as top-level elements, then the element must be ignored along with its content;
if it is an element in a template and XSLT 1.0 does not allow such elements to occur in templates, then if the element is not instantiated, an error must not be signaled, and if the element is instantiated, the XSLT must perform fallback for the element as specified in 15 Fallback;
if the element has an attribute that XSLT 1.0 does not allow the element to have or if the element has an optional attribute with a value that the XSLT 1.0 does not allow the attribute to have, then the attribute must be ignored.
Thus, any XSLT 1.0 processor must be able to process the following stylesheet without error, although the stylesheet includes elements from the XSLT namespace that are not defined in this specification:
<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:choose>
<xsl:when test="system-property('xsl:version') >= 1.1">
<xsl:exciting-new-1.1-feature/>
</xsl:when>
<xsl:otherwise>
<html>
<head>
<title>XSLT 1.1 required</title>
</head>
<body>
<p>Sorry, this stylesheet requires XSLT 1.1.</p>
</body>
</html>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet> |
Note:
If a stylesheet depends crucially on a top-level element
introduced by a version of XSL after 1.0, then the stylesheet can use
an xsl:message element with terminate="yes"
(see 13 Messages) to ensure that XSLT processors
implementing earlier versions of XSL will not silently ignore the
top-level element. For example,
<xsl:stylesheet version="1.5"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:important-new-1.1-declaration/>
<xsl:template match="/">
<xsl:choose>
<xsl:when test="system-property('xsl:version') < 1.1">
<xsl:message terminate="yes">
<xsl:text>Sorry, this stylesheet requires XSLT 1.1.</xsl:text>
</xsl:message>
</xsl:when>
<xsl:otherwise>
...
</xsl:otherwise>
</xsl:choose>
</xsl:template>
...
</xsl:stylesheet> |
If an expression occurs in an attribute that is processed in forwards-compatible mode, then an XSLT processor must recover from errors in the expression as follows:
if the expression does not match the syntax allowed by the XPath grammar, then an error must not be signaled unless the expression is actually evaluated;
if the expression calls a function with an unprefixed name that is not part of the XSLT library, then an error must not be signaled unless the function is actually called;
if the expression calls a function with a number of arguments that XSLT does not allow or with arguments of types that XSLT does not allow, then an error must not be signaled unless the function is actually called.
XSLT provides two mechanisms to combine stylesheets:
an inclusion mechanism that allows stylesheets to be combined without changing the semantics of the stylesheets being combined, and an import mechanism that allows stylesheets to override each other.
An XSLT stylesheet may include another XSLT stylesheet using an
xsl:include element. The xsl:include element
has an href attribute whose value is a URI reference
identifying the stylesheet to be included. A relative URI is resolved
relative to the base URI of the xsl:include element (see
3.2 Base URI).
The xsl:include element is only allowed as a top-level element.
The inclusion works at the XML tree level. The resource located by
the href attribute value is parsed as an XML document,
and the children of the xsl:stylesheet element in this
document replace the xsl:include element in the including
document. The fact that template rules or definitions are included
does not affect the way they are processed.
The included stylesheet may use the simplified syntax described in
2.3 Literal Result Element as Stylesheet. The included stylesheet
is treated the same as the equivalent xsl:stylesheet
element.
It is an error if a stylesheet directly or indirectly includes itself.
Note:
Including a stylesheet multiple times can cause errors because of duplicate definitions. Such multiple inclusions are less obvious when they are indirect. For example, if stylesheet B includes stylesheet A, stylesheet C includes stylesheet A, and stylesheet D includes both stylesheet B and stylesheet C, then A will be included indirectly by D twice. If all of B, C and D are used as independent stylesheets, then the error can be avoided by separating everything in B other than the inclusion of A into a separate stylesheet B' and changing B to contain just inclusions of B' and A, similarly for C, and then changing D to include A, B', C'.
An XSLT stylesheet may import another XSLT stylesheet using an
xsl:import element. Importing a stylesheet is the same
as including it (see 2.6.1 Stylesheet Inclusion) except that definitions
and template rules in the importing stylesheet take precedence over
template rules and definitions in the imported stylesheet; this is
described in more detail below. The xsl:import element
has an href attribute whose value is a URI reference
identifying the stylesheet to be imported. A relative URI is resolved
relative to the base URI of the xsl:import element (see
3.2 Base URI).
The xsl:import element is only allowed as a top-level element. The
xsl:import element children must precede all other
element children of an xsl:stylesheet element, including
any xsl:include element children. When
xsl:include is used to include a stylesheet, any
xsl:import elements in the included document are moved up
in the including document to after any existing
xsl:import elements in the including document.
For example,
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="article.xsl"/>
<xsl:import href="bigfont.xsl"/>
<xsl:attribute-set name="note-style">
<xsl:attribute name="font-style">italic</xsl:attribute>
</xsl:attribute-set>
</xsl:stylesheet> |
[Definition: The
xsl:stylesheet elements encountered during processing of
a stylesheet that contains xsl:import elements are
treated as forming an import tree. In the import tree,
each xsl:stylesheet element has one import child for each
xsl:import element that it contains. Any
xsl:include elements are resolved before constructing the
import tree.] [Definition: An xsl:stylesheet element in the import tree
is defined to have lower import precedence than another
xsl:stylesheet element in the import tree if it would be
visited before that xsl:stylesheet element in a
post-order traversal of the import tree (i.e. a traversal of the
import tree in which an xsl:stylesheet element is visited
after its import children).] Each definition and template
rule has import precedence determined by the
xsl:stylesheet element that contains it.
For example, suppose
stylesheet A imports stylesheets B and C in that order;
stylesheet B imports stylesheet D;
stylesheet C imports stylesheet E.
Then the order of import precedence (lowest first) is D, B, E, C, A.
Note:
Since xsl:import elements are required to occur
before any definitions or template rules, an implementation that
processes imported stylesheets at the point at which it encounters the
xsl:import element will encounter definitions and
template rules in increasing order of import precedence.
In general, a definition or template rule with higher import precedence takes precedence over a definition or template rule with lower import precedence. This is defined in detail for each kind of definition and for template rules.
It is an error if a stylesheet directly or indirectly imports
itself. Apart from this, the case where a stylesheet with a particular
URI is imported in multiple places is not treated specially. The
import tree will have a
separate xsl:stylesheet for each place that it is
imported.
Note:
If xsl:apply-imports is used (see 5.6 Overriding Template Rules), the behavior may be different from the
behavior if the stylesheet had been imported only at the place with
the highest import
precedence.
Normally an XSLT stylesheet is a complete XML document with the
xsl:stylesheet element as the document element. However,
an XSLT stylesheet may also be embedded in another resource. Two forms
of embedding are possible:
the XSLT stylesheet may be textually embedded in a non-XML resource, or the
xsl:stylesheetelement may occur in an XML document other than as the document element.
To facilitate the second form of embedding, the
xsl:stylesheet element is allowed to have an ID attribute
that specifies a unique identifier.
Note:
In order for such an attribute to be used with the XPath id function, it must actually be declared in the DTD as being an ID.
The following example shows how the xml-stylesheet
processing instruction [XML Stylesheet] can be used to allow a
document to contain its own stylesheet. The URI reference uses a
relative URI with a fragment identifier to locate the
xsl:stylesheet element:
<?xml-stylesheet type="text/xml" href="#style1"?>
<!DOCTYPE doc SYSTEM "doc.dtd">
<doc>
<head>
<xsl:stylesheet id="style1"
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:import href="doc.xsl"/>
<xsl:template match="id('foo')">
<fo:block font-weight="bold"><xsl:apply-templates/></fo:block>
</xsl:template>
<xsl:template match="xsl:stylesheet">
<!-- ignore -->
</xsl:template>
</xsl:stylesheet>
</head>
<body>
<para id="foo">
...
</para>
</body>
</doc>
|
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.
The data model used by XSLT is the same as that used by XPath with the additions described in this section. XSLT operates on source, result and stylesheet documents using the same data model. Any two XML documents that have the same tree will be treated the same by XSLT.
Processing instructions and comments in the stylesheet are ignored: the stylesheet is treated as if neither processing instruction nodes nor comment nodes were included in the tree that represents the stylesheet.
The normal restrictions on the children of the root node are relaxed for the result tree. The result tree may have any sequence of nodes as children that would be possible for an element node. In particular, it may have text node children, and any number of element node children. When written out using the XML output method (see 16 Output), it is possible that a result tree will not be a well-formed XML document; however, it will always be a well-formed external general parsed entity.
When the source tree is created by parsing a well-formed XML document, the root node of the source tree will automatically satisfy the normal restrictions of having no text node children and exactly one element child. When the source tree is created in some other way, for example by using the DOM, the usual restrictions are relaxed for the source tree as for the result tree.
Every node also has an associated URI called its base URI, which is used for resolving attribute values that represent relative URIs into absolute URIs. If an element or processing instruction occurs in an external entity, the base URI of that element or processing instruction is the URI of the external entity; otherwise, the base URI is the base URI of the document. The base URI of the document node is the URI of the document entity. The base URI for a text node, a comment node, an attribute node or a namespace node is the base URI of the parent of the node.
The root node has a mapping that gives the URI for each unparsed entity declared in the document's DTD. The URI is generated from the system identifier and public identifier specified in the entity declaration. The XSLT processor may use the public identifier to generate a URI for the entity instead of the URI specified in the system identifier. If the XSLT processor does not use the public identifier to generate the URI, it must use the system identifier; if the system identifier is a relative URI, it must be resolved into an absolute URI using the URI of the resource containing the entity declaration as the base URI [RFC2396].
After the tree for a source document or stylesheet document has been constructed, but before it is otherwise processed by XSLT, some text nodes are stripped. A text node is never stripped unless it contains only whitespace characters. Stripping the text node removes the text node from the tree. The stripping process takes as input a set of element names for which whitespace must be preserved. The stripping process is applied to both stylesheets and source documents, but the set of whitespace-preserving element names is determined differently for stylesheets and for source documents.
A text node is preserved if any of the following apply:
The element name of the parent of the text node is in the set of whitespace-preserving element names.
The text node contains at least one non-whitespace character. As in XML, a whitespace character is #x20, #x9, #xD or #xA.
An ancestor element of the text node has an
xml:space attribute with a value of
preserve, and no closer ancestor element has
xml:space with a value of
default.
Otherwise, the text node is stripped.
The xml:space attributes are not stripped from the
tree.
Note:
This implies that if an xml:space attribute is
specified on a literal result element, it will be included in the
result.
For stylesheets, the set of whitespace-preserving element names
consists of just xsl:text.
For source documents, the set of whitespace-preserving element
names is specified by xsl:strip-space and
xsl:preserve-space top-level elements. These elements each
have an elements attribute whose value is a
whitespace-separated list of NameTests. Initially, the
set of whitespace-preserving element names contains all element names.
If an element name matches a NameTest in an
xsl:strip-space element, then it is removed from the set
of whitespace-preserving element names. If an element name matches a
NameTest in an
xsl:preserve-space element, then it is added to the set
of whitespace-preserving element names. An element matches a NameTest if and only if the
NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error for an expression to include a call to any other function
A list of source nodes is processed to create a result tree fragment. The result tree is constructed by processing a list containing just the root node. A list of source nodes is processed by appending the result tree structure created by processing each of the members of the list in order. A node is processed by finding all the template rules with patterns that match the node, and choosing the best amongst them; the chosen rule's template is then instantiated with the node as the current node and with the list of source nodes as the current node list. A template typically contains instructions that select an additional list of source nodes for processing. The process of matching, instantiation and selection is continued recursively until no new source nodes are selected for processing.
Implementations are free to process the source document in any way that produces the same result as if it were processed using this processing model.
[Definition: Template rules identify the nodes to which they apply by using a pattern. As well as being used in template rules, patterns are used for numbering (see 7.7 Numbering) and for declaring keys (see 12.2 Keys). A pattern specifies a set of conditions on a node. A node that satisfies the conditions matches the pattern; a node that does not satisfy the conditions does not match the pattern. The syntax for patterns is a subset of the syntax for expressions. In particular, location paths that meet certain restrictions can be used as patterns. An expression that is also a pattern always evaluates to an object of type node-set. A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors.]
Here are some examples of patterns:
para matches any para element
* matches any element
chapter|appendix matches any
chapter element and any appendix
element
olist/item matches any item element with
an olist parent
appendix//para matches any para element with
an appendix ancestor element
/ matches the root node
text() matches any text node
processing-instruction() matches any processing
instruction
node() matches any node other than an attribute
node and the root node
id("W11") matches the element with unique ID
W11
para[1] matches any para element
that is the first para child element of its
parent
*[position()=1 and self::para] matches any
para element that is the first child element of its
parent
para[last()=1] matches any para
element that is the only para child element of its
parent
items/item[position()>1] matches any
item element that has a items parent and
that is not the first item child of its parent
item[position() mod 2 = 1] would be true for any
item element that is an odd-numbered item
child of its parent.
div[@class="appendix"]//p matches any
p element with a div ancestor element that
has a class attribute with value
appendix
@class matches any class attribute
(not any element that has a class
attribute)
@* matches any attribute
A pattern must match the grammar for NameTest would be true
for the element as an XPath node
test. Conflicts between matches to
xsl:strip-space and xsl:preserve-space
elements are resolved the same way as conflicts between template rules
(see 5.5 Conflict Resolution for Template Rules). Thus, the applicable match for a
particular element name is determined as follows:
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.
It is an error if this leaves more than one match. An XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matches that are left, the one that occurs last in the stylesheet.
XSLT uses the expression language defined by XPath [XPath]. Expressions are used in XSLT for a variety of purposes including:
selecting nodes for processing; specifying conditions for different ways of processing a node; generating text to be inserted in the result tree.
[Definition: An expression must match the XPath production Expr.]
Expressions occur as the value of certain attributes on XSLT-defined elements and within curly braces in attribute value templates.
In XSLT, an outermost expression (i.e. an expression that is not part of another expression) gets its context as follows:
the context node comes from the current node
the context position comes from the position of the current node in the current node list; the first position is 1
the context size comes from the size of the current node list
the variable bindings are the bindings in scope on the element which has the attribute in which the expression occurs (see 11 Variables and Parameters)
the set of namespace declarations are those in scope on the
element which has the attribute in which the expression occurs;
this includes the implicit declaration of the prefix xml
required by the the XML Namespaces Recommendation [XML Names];
the default
namespace (as declared by xmlns) is not part of this
set
the function library consists of the core function library together with the additional functions defined in 12 Additional Functions and extension functions as described in 14 Extensions; it is an error