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

Serendipity by Stacey Bentley
Christina's Bear by Jane Wakely
Nigel Benn by Nigel Benn
Save the Last Vamp for Me by Gayla Drummond
Switchback by Catherine Anderson
The Last Magazine: A Novel by Michael Hastings
Winter Solstice by Pilcher, Rosamunde