Subject: Re: reversing or swapping nested node hierarchy
From: Chris Capon <abyss@xxxxxxxxxxx>
Date: Tue, 21 Mar 2006 16:59:58 -0500
|
David Carlisle wrote:
>>Is it valid to design a stylesheet which depends on the order in which
>>templates are declared?
>>
>>
>
>No, the order makes no difference (except when recovering from an error)
>It is an error to have two templates that match a mode with the same
>priority.
>
>
>
Where more than one template could match, I have always set the order of
the templates since the second always seems to take precidence over the
first. Now I realize it is the wrong approach.
>>For instance, match="*" and match="*[b]" could both apply
>>to an element containing a <b> element.
>>
>>
>
>Both patterns match such an element but only the *[b] template will be
>invoked as *[b] has a higher default priority than *. You can override
>the default priority by going priority="123" for any number that you
>choose.
>
>
>
>
Very cool. I did not know that one could apply priorities to
templates. That just makes life a whole lot easier.
Thank you.
Chris.
|