This section gives an informal description of the syntax of XSLT patterns. For a formal specification, see the XSLT recommendation. Pattern syntax did not change significantly in XSLT 2.0, except by allowing any XPath 2.0 expression to be used within a predicate. XSLT 3.0 introduces extension, described below, to allow atomic values as well as nodes to be matched, and by removing a number of restrictions. Some of these changes (but not all) are implemented in Saxon 9.4 when XSLT 3.0 processing is enabled.
Patterns define a condition that a node may or may not satisfy: a node either matches the pattern, or it does not. The syntax of patterns is a subset of that for the XPath expressions, and formally, a node matches a pattern if it is a member of the node set selected by the corresponding expression, with some ancestor of the node acting as the current node for evaluating the expression. For example a TITLE node matches the pattern "TITLE" because it is a member of the node set selected by the expression "TITLE" when evaluated at the immediate parent node.
In XSLT stylesheets, patterns are used primarily in the
match attribute of the
They are also used in the
from attributes of
match attribute of
xsl:key, and the
The next page gives some examples of match patterns and their meaning. This is followed by a page that gives a summary of the XSLT 2.0 syntax, and another page that describes the extensions to patterns in XSLT 3.0.