Nic Miloslav
Example 69***
Often several templates match selected element in XML source. It must be therefore decided which one to use. The templates are ordered according their priority which can be specified with priority attributte. If the template does not have this attribute, its priority is calculated according to several rules. Stylesheet 1 and Stylesheet 2 differ by priority of their templates. Stylesheet 3 shows the default action in the absence of priority attributes. Template CCC has lower priority than CCC/CCC, as it is less specific. Compare Stylesheet 4 and Stylesheet 5. Template CCC has lower priority than both CCC/CCC or AAA/CCC/CCC, but the latest two have the same priority. In such a case an XSLT processor may signal the error; if it does not signal the error, it must recover by choosing, from amongst the matching template rules that are left, the one that occurs last in the stylesheet. In Stylesheet 6 less specific * has lower priority than CCC. Computed priorities ranges fromt -0.5 to 0.5. XSLT spec gives more details.