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
3.03Mb 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 Land of Decoration by Grace McCleen
If I Were Your Woman by Donna Hill
Winterwood by JG Faherty
Rush Against Time by Willow Brooke
An Improper Proposal by Cabot, Patricia
Seductive Chaos (Bad Rep #3) by A. Meredith Walters
Mad Season by Nancy Means Wright
Not Quite Dating by Catherine Bybee