xsl-list
[Top] [All Lists]

Re: [xsl] reversing or swapping nested node hierarchy

2006-03-21 15:04:10
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.


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--