xsl-list
[Top] [All Lists]

Re: Tricky inclusion match

2005-03-30 11:02:10
I was looking at the post I just sent and realized it came out somewhat incoherently. (It must be an messed-up mail daemon somewhere.)

At 12:27 PM 3/30/2005, I wrote:
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.

This paragraph describes the test in the *first* predicate ... [not(. = preceding-sibling::*)] ... not the second.

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.

This paragraph describes the test in the second predicate ... [.=$colors]

I hope that helps!

Cheers,
Wendell


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
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
======================================================================


--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>