|
Subject: select-distinct in for-each ? From: "Clark C. Evans" <clark.evans@xxxxxxxxxxxxxxxxxxxx> Date: Sun, 3 Oct 1999 02:44:29 -0400 (EDT) |
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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| XSLServlet & Apache, Clark C. Evans | Thread | RE: select-distinct in for-each ?, Jarno Elovirta |
| XSLServlet & Apache, Clark C. Evans | Date | RE: select-distinct in for-each ?, Jarno Elovirta |
| Month |