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
10.22Mb 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

No Time for Goodbyes by Andaleeb Wajid
The Singing Fire by Lilian Nattel
Into The Fire (The Ending Series) by Fairleigh, Lindsey, Pogue, Lindsey
Between by Lisa Swallow
Mist on the Meadow by Karla Brandenburg
The Rifle by Gary Paulsen