[Previous] [Contents] [Next]


Resolving Selection Conflicts


It's possible for more than one template rule to apply to the same source element. When this occurs, the more specific rule applies. For example, the following rules that select the same element are given in decreasing order of specificity.

1. id(line1)-The ID attribute value is the most specific (remember that ID values have to be unique).
2. line[attribute(type)='line-no',attribute(line-no)='1']-Selects any element with a specific attribute and attribute value pair (because it isn't an ID attribute the attribute value doesn't have to be unique).
3. line[attribute(type)='line-no']-Selects any element with a specific attribute name.
4. line-Selects all the elements with that element name.
5. *-Selects any element (a wildcard is the least specific).

If you want more control over the applicability of a template, you can specify a template priority attribute and assign it a positive integer value:

     <xsl:template match="section/title" priority="1">
       <fo:block>
     <xsl:apply-templates/>
       </fo:block>
     </xsl:template>

The higher the priority value, the higher the priority of the template rule. The default value (used if you do not specify a priority value) is 0.

[Previous] [Contents] [Next]