Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
If there are several matching templates left, and they all have the same import precedence and priority, the XSLT processor can either choose the one that occurs last in declaration order or report an error. Import precedence and declaration order are described under
If there are no templates that match the selected node, the built-in template for the relevant node kind is used. Built-in templates are described under
The rules for determining the default priority for a pattern are given in Chapter 12, on page 686.
Although the default priorities are carefully chosen, they do not guarantee that a highly selective pattern will always have higher priority than a less selective pattern. For example, the patterns
section/para
and
section/para[1]
both have priority +0.5. Similarly, the patterns
attribute(*, xs:integer)
and
attribute(*, xs:decimal)
have the same priority, even though the nodes that match the first pattern are a subset of those that match the second. Choosing your own priorities is therefore a more reliable approach.
The mode Attribute
If the
mode
attribute, then it applies only to the default (unnamed) mode, and it will be invoked only in response to an
mode
attribute, if its
mode
attribute has the value
#default
, or if its
mode
attribute has the value
#current
and the current mode is the default mode. The concept of the current mode is explained on page 238.
If the
mode
attribute is present and has the value
#all
, then the template is applicable to all modes.