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