Subject: Re: [xsl] Tricky inclusion match From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 30 Mar 2005 13:02:10 -0500 |
Expanded into long syntax the expression looks like this:
child::color[not(self::node() = preceding-sibling::color)][self::node() = $colors]
That is, it selects all the child 'color' elements, eliminates those whose values are the same as a preceding-sibling's value, and from those, keeps those whose values are equal to $colors.
The second predicate (bracketed expression) is a standard idiom for removing duplicates, and as such is simple enough. For large sets of siblings it's an expensive test (though it's the analogous test on the preceding:: axis that really gets expensive), which is why we often prefer key-retrieval techniques for de-duplication. (In this case the key-retrieval technique is cumbersome and doesn't gain us much.) You've seen this: it's central to Muenchian grouping.
Because of the way the equality operator works with node-sets (it returns true if the value of any node in the first set is equal to the value of any node in the second set), this has the result of keeping any color that is listed among the $colors.
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Tricky inclusion match, Wendell Piez | Thread | Re: [xsl] Tricky inclusion match, Karl Stubsjoen |
RE: [xsl] Testing 2 XML documents f, Mukul Gandhi | Date | [xsl] Using Javascript to pass para, Maria Amuchastegui |
Month |