Name

xsl:template

Attributes

match, optional

A pattern against which nodes can be compared. This pattern is a location path using only the child, attribute, and descendant-or-self axes or a combination of several such location paths.

priority, optional

A number. If more than one template rule with the same import precedence matches a given node, the one with the highest priority is chosen. If this attribute is not present, then the template rule's priority is calculated in the following way:

  • Template rules with match patterns composed of just an element or attribute name (e.g., person or @profession) have priority 0.

  • Template rules with match patterns composed of just a processing-instruction('target') node test have priority 0.

  • Template rules with match patterns in the form prefix :* have priority -0.25.

  • Template rules with match patterns that just have a wildcard node test (*, @*, comment(), node( ), text( ), and processing-instruction( )) have priority -0.5. (This means that built-in template rules have priority -0.5. However, they are also imported before all other template rules, and thus never override any explicit template rule, regardless of priority.)

  • Template rules with any other patterns (person[name='Feynman'], people/person/@profession, person/text( ), etc.) have priority 0.5.

It is an error if two or more template rules match a node and have the same priority. However, in this case, most XSLT processors choose the last template rule occurring in the stylesheet, rather than signaling the error.

name, optional

A name by which this template rule can be invoked from an xsl:call-template element, rather than by node matching.

mode, optional

If the xsl:template element has a mode, then this template rule is matched only when the calling instruction's mode attribute matches this mode attribute's value.