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

Re: XPath expression to derive list of distinct elemen

Subject: Re: XPath expression to derive list of distinct element names
From: Joerg Pietschmann <joerg.pietschmann@xxxxxx>
Date: Thu, 10 Jan 2002 14:59:02 +0100
xpath expression select distinct
> From: David Carlisle <davidc@xxxxxxxxx>
> doesn't
>   select="$x//*[not(following::*[name()=name(current())])]"
> select all the element nodes in $x that are the last occurrence of an
>   element of that name?

As far as i can see not, unless you redefine the current() function.
Why not using the Muenchian method?

 <xsl:key name="sibling-names" match="*" use="concat(generate-id(..),'#',name())"/>
 ...
    select="*[generate-id()=generate-id(key(generate-id(..),'#',name())[1])]"

Untested. There are some obvious optimizations.

I'm not sure whether this is what the original poster wanted
but HTH anyway.

I also hope Jeni is absorbed with other stuff enough that i
can beat her this time...  :-)

J.Pietschmann

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.