Z
Zachary Turner
I have a bunch of nodes like this:
<a>
<b>
<b>
<c>
</a>
<a>
<b>
<c>
<d>
<f>
</a>
I perform a select query similar to "a/*" (actually much more
complicated, but the idea is the same), and set the result equal to a
variable.
<xsl:variable name="nodeSet" select="a/*"/>
I now want a new variable like this:
<xsl:variable name="uniqueNodeSet" select=""/>
That only returns nodes in the set that do not have the same local-
name() as any other element in the set. So basically just trim out
elements with dupliacte local-names. I know this has come up before,
I did search the usenet archives and there were many posts asking
similar questions, but I was not able to massage the solutions into
one that worked for my case. The best I could do was
select="$nodeSet[not(local-name()=local-name(a/*))]"
but for some reason that doesn't seem to get rid of the duplicates.
I could probably do this using a long drawn out recursive template,
but I'm sure there's an easier way.
Any help greatly appreciated.
Thanks
<a>
<b>
<b>
<c>
</a>
<a>
<b>
<c>
<d>
<f>
</a>
I perform a select query similar to "a/*" (actually much more
complicated, but the idea is the same), and set the result equal to a
variable.
<xsl:variable name="nodeSet" select="a/*"/>
I now want a new variable like this:
<xsl:variable name="uniqueNodeSet" select=""/>
That only returns nodes in the set that do not have the same local-
name() as any other element in the set. So basically just trim out
elements with dupliacte local-names. I know this has come up before,
I did search the usenet archives and there were many posts asking
similar questions, but I was not able to massage the solutions into
one that worked for my case. The best I could do was
select="$nodeSet[not(local-name()=local-name(a/*))]"
but for some reason that doesn't seem to get rid of the duplicates.
I could probably do this using a long drawn out recursive template,
but I'm sure there's an easier way.
Any help greatly appreciated.
Thanks