[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Rule conflict resolution

Subject: Re: Rule conflict resolution
From: Tyler Baker <tyler@xxxxxxxxxxx>
Date: Thu, 05 Nov 1998 17:28:04 -0500
conflict resolution for template rules
Aneel Nazareth wrote:

> Hello all,
> I'm working on an XSL processor, and I have a question about conflict
> resolution for template rules.
> It seems to me that the precedence for template rules is static (independent
> of context). This means that the XSL processor should be able to simply sort
> the rules once and go down the list in order whenever rules are applied. This
> also means that, if the stylesheet author wanted to do so, she could sort the
> rules into the same order by hand ahead of time.

The big stickler here is how do you sort with respect to ElementTypePatterns and
AttributePatterns.  If there were no AttributePatterns, then this would be
simple.  Also, using the element name of the last ElementTypePattern in a match
pattern as a hash object would be simple, but since there are AttributePatterns,
you essentially have to iterate through the entire list of templates.
Nevertheless, I have found that if you internalise the names when doing pattern
matching, building some sort of hashtable of templates is pretty pointless since
iterating through 100 or less template match patterns and doing an identity
comparison on either the element name of the last element type pattern or the
attribute name of the last attribute pattern is faster than messing with a
hashtable in the first place.

> My question is this: why not just keep the rules in the order that they are
> found (document order). (Presumably reverse document order, so you'd put
> general rules first and specific rules later, but that's beside the point).
> This allows the functionality of the current system, and also allows the user
> more control over the order of rule application, if desired.

This is the idea, but your problem here is with ElementTypePatterns and

> The Drawback that I see in this scheme is that it imposes a particular
> organization on the stylesheet, while the author might prefer to organize it
> differently. Are there other reasons to not do this?

The order of the templates is not important.  In fact, the only stylesheet
element that has any significance with respect to the order it comes in I believe
is xsl:include.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.