this get ever more complicated :)
now i face another issue in last question we managed to take unique values from only one parent node
now with:
<?xml version="1.0" encoding="ISO-8859-1"?>
<roots>
<root>
<name>first</name>
<item>
<something>A</something>
<something>A</something>
</item>
<item>
<something>B</something>
<something>A</something>
</item>
<item>
<something>C</something>
<something>P</something>
</item>
<item>
<something>A</something>
<something>L</something>
</item>
<item>
<something>A</something>
<something>A</something>
</item>
<item>
<something>B</something>
<something>A</something>
</item>
<item>
<something>D</something>
<something>A</something>
</item>
</root>
<root>
<name>second</name>
<item>
<something>E</something>
<something>A</something>
</item>
<item>
<something>B</something>
<something>A</something>
</item>
<item>
<something>F</something>
<something>A</something>
</item>
<item>
<something>A</something>
<something>A</something>
</item>
<item>
<something>A</something>
<something>A</something>
</item>
<item>
<something>B</something>
<something>H</something>
</item>
<item>
<something>D</something>
<something>G</something>
</item>
</root>
</roots>
now i need to get the unique values depending only from one node before but just from the elements on the second position
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" method="text"/>
<xsl:key name="item-by-value" match="something"
use="concat(normalize-space(.), ' ', generate-id(./ancestor::root))"/>
<xsl:key name="rootkey" match="root" use="name"/>
<xsl:template match="/">
<xsl:for-each select="key('rootkey','first')">
<xsl:for-each select="item/something[1]">
<xsl:sort />
<xsl:if test="generate-id() = generate-id(key('item-by-value',
concat(normalize-space(.), ' ', generate-id(./ancestor::root))))">
<xsl:value-of select="."/>
</xsl:if>
</xsl:for-each>
<xsl:text>_________</xsl:text>
<xsl:for-each select="item/something[2]">
<xsl:sort />
<xsl:if test="generate-id() = generate-id(key('item-by-value',
concat(normalize-space(.), ' ', generate-id(./ancestor::root))))">
<xsl:value-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
with this XSL i get ABCD__LP where the result i need is ABCD__ALP
any ideas?