XSLT patterns

This section gives an informal description of the syntax of XSLT patterns. For a formal specification, see the XSLT recommendation. XSLT 3.0 introduces extensions, described below, to allow atomic values as well as nodes to be matched, and removes a number of restrictions. Saxon (since version 9.6) implements these extensions.

Patterns define a condition that an item may or may not satisfy: an item either matches the pattern, or it does not. The syntax of patterns is a subset of that for the XPath syntax. In XSLT 3.0 there are two kinds of pattern:

Patterns are used primarily in the match attribute of the xsl:template element. They are also used in the count and from attributes of xsl:number, the match attribute of xsl:key, and the group-starting-with and group-ending-with attributes of xsl:for-each-group.

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.