|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] select-distinct in for-each ?
Hello. I have a hierarchy 3 layers deep, and I'm
trying to build a cross-reference of a repeating
group in the lowest layer. To do this, I have
a <xsl:for-each ... /> with a <xsl:sort ... /> .
As you guess, I have duplicates that need to
be removed -- I'm looking for a select-distinct.
I found this in the FAQ but it partially works:
Q: 2.46
How to remove duplicate nodes from a
node-set according to content?
A: 2.46 - David Carlisle
select="reference[not(@name=following::reference/@name)]"
will return you a list of reference elements with no
two having the same name.
Here is my sample data:
<a>
<b>
<c>X</c>
</b>
<b>
<c>X</c>
</b>
<b>
<x>Z</x>
</b>
</a>
<a>
<b>
<c>X</c>
</b>
</a>
What I want is:
X
Z
What I tried (among many many other things...)
<xsl:for-each select="//c[not(text()=following::c/text())]" >
<xsl:sort order="ascending" select="." />
<xsl:value-of select="." /><br/>
</xsl:for-each>
What I get using August 22 version of XT
X
X
Z
...
It seems that following:: is grabbing the
next sibling, however, if you go up one
node and then go back down it does not
seem to pick this up.
Am I missing anything?
Thanks!
Clark
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








