XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition (491 page)

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
7.88Mb size Format: txt, pdf, ePub

All these values are chosen to leave you free to allocate your own priorities as natural numbers, for example
1
2
3
, and such templates will always be chosen ahead of those with a system-allocated default priority.

You may find that stylesheets are easier to understand and less error prone if you avoid relying on default priorities, and use explicit priorities whenever you have more than one template rule that can match the same node.

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.

Other books

The Worm Ouroboros by E. R. Eddison
Vera by Stacy Schiff
Twilight Falling by Kemp, Paul S.
Mermaids Singing by Dilly Court
Out of the Mountains by David Kilcullen
Against the Ropes by Carly Fall
Wild for Him by Jill Sorenson
ICEHOTEL by Allen, Hanna