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.12Mb 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

X: The Hard Knocks Complete Story by Michelle A. Valentine
Their Runaway Mate by Cross, Selena
Panacea by Viola Grace
Dinner for Two by Mike Gayle
Dungeons by Jones, Ivy M.
Secrets of the Deep by E.G. Foley
Almost Home by Mariah Stewart