This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: XPath expression to derive list of distinct element names
- From: Joerg Pietschmann <joerg dot pietschmann at zkb dot ch>
- To: XSL List <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 10 Jan 2002 14:59:02 +0100
- Subject: Re: [xsl] XPath expression to derive list of distinct element names
- Organization: ZKB
- Reply-to: xsl-list at lists dot mulberrytech dot com
> From: David Carlisle <davidc@nag.co.uk>
> 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