Chapter 12. XSLT Patterns
A pattern is used in XSLT to define a condition that a node must satisfy in order to be selected. The most common use of patterns is in the
match attribute of
<xsl:template>, where the pattern says which nodes the template rule applies to. For example,
<xsl:template match ="abstract" introduces a template rule that matches every
<abstract> element. This chapter defines the syntax and meaning of XSLT patterns.
Patterns (sometimes called match patterns) are used in just six places in an XSLT stylesheet:
<xsl:template>, to define the nodes in a source document to which a template applies
<xsl:key>, to define the nodes in a source document to which a key definition applies
<xsl:number>, to define which nodes are counted when generating numbers
<xsl:for-each-group>, to identify a node that acts as the initial or final node in a group of related nodes
Patterns and Expressions
Most of the patterns found in stylesheets are simple and intuitive. For example:
The rules for the more complex patterns, ...