Table of contents
Appendices
|
5.5 Conflict Resolution for Template Rules
Conflict Resolution for Template Rules
It is possible for a source node to match more than one template
rule. The template rule to be used is determined as follows:
-
First, all matching template rules that have lower Import Precedence than the
matching template rule or rules with the highest import precedence are
eliminated from consideration.
-
Next, all matching template rules that have lower priority
than the matching template rule or rules with the highest priority are
eliminated from consideration. The priority of a template rule is
specified by the priority attribute on the template rule.
The value of this must be a real number (positive or negative),
matching the production Number
with an optional leading minus sign (-). The default
priority is computed as follows:
Thus, the most common kind of pattern (a pattern that tests for a
node with a particular type and a particular expanded-name) has
priority 0. The next less specific kind of pattern (a pattern that
tests for a node with a particular type and an expanded-name with a
particular namespace URI) has priority -0.25. Patterns less specific
than this (patterns that just tests for nodes with particular types)
have priority -0.5. Patterns more specific than the most common kind
of pattern have priority 0.5.
It is an error if this leaves more than one matching template
rule. An XSLT processor may signal the error; if it does not signal
the error, it must recover by choosing, from amongst the matching
template rules that are left, the one that occurs last in the
stylesheet.
|