Start New Discussion within our Software Development Community

Who do know a solution for the following issue:

I need to program in XSL a check for double element is a part of the tree.
xpath preceding-sibling does not check enough element of the tree and preceding to much.
my tree like as:

root
|
----------------------------------------------------------------------------
| | |
Tree1 Tree 2 Tree 3
--------------- ----------------------- ------------------
| | | | | |
-------- ------- ----------- ------------ --------- -------
| | | | | | | | | | | |
A B C C D B A E A G A B

In this tree are the attribute C in Tree 1 double also the attributes A in Tree 3
The A in Tree 1 and Tree 2 are not double of Tree 3

In my result I need
Tree 1 A
Tree 1 B
Tree 1 C
Tree 2 D
Tree 2 B
Tree 2 A
Tree 2 E
Tree 3 A
Tree 3 G
Tree 3 B

Who do know a Stylesheet (XSL) solution for this problem.
<xsl:for-each select= "Tree/*/@A">
<xsl:if test= "not(@A =preceding::*/@A)">
<xsl:value-of select="@A"/>
</xsl:if>
</xsl:for-each>

This solution give:
Tree 1 A
Tree 1 B
Tree 1 C
Tree 2 D
Tree 2 E
Tree 3 G

It is difficult to understand the structure of your xml file from your supplied description. Please supply an example.

This article has been dead for over six months. Start a new discussion instead.