The value of the match attribute of the <xsl:template> instruction must be a matching pattern.
Matching patterns form a subset of the set of all possible XPath expressions . The first natural limitation is that the mapping pattern must select a set of nodes. There are other limitations. In particular, inverse axes are not allowed in the location steps (but can be specified in predicates). In addition, variables or parameters are not allowed in XSLT 1.0, but their use is permitted in XSLT 2.x.
/ in XPath denotes the root node or document node. In XPath 2.0 (and therefore XSLT 2.x), this can also be written as document-node() .
The match pattern may contain the abbreviation // .
Examples of match patterns:
<xsl:template match="table">
can be applied to any element named table .
<xsl:template match="x/y">
can be applied to any element named y whose parent is an element named x .
<xsl:template match="*">
can be applied to any element.
<xsl:template match="/*">
can only be applied to the top element of an XML document.
<xsl:template match="@*">
can be applied to any attribute.
<xsl:template match="text()">
can be applied to any text node.
<xsl:template match="comment()">
can be applied to any comment node.
<xsl:template match="processing-instruction()">
can be applied to any node of the processing instruction.
<xsl:template match="node()">
can be applied to any node: element, text, comment, or processing instruction.