Template Conflict Resolution

Another important aspect of template use is conflict resolution. If two templates match the same node or node set, XSLT relies on the priority of the two templates to determine which template to apply.

Each template has a default priority based on the select attribute value. Generally, the more specific the match or expression (such as "PLANET" versus "*" ) is, the higher its priority. Chapter 4 looks at how the processor determines priorities and how the processor deals with templates that have the same priority.

You can also set the priority of a template with the priority attribute. Here’s an example; in this case, a rule created with the element <xsl:template priority="1"/> has lower priority than one created ...

Get Inside XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.