I need to filter operation in some of the nodes which are duplicate (on a key) Following are my data file.
data.xml
<root>
<node name="item1" />
<node name="item2" />
<node name="item3" />
<node name="item4" />
</root>
in file item1.xml
<item>
<group>A</group>
</item>
item2.xml
<item>
<group>B</group>
</item>
item3.xml
<item>
<group>B</group>
</item>
item4.xml
<item>
<group>D</group>
</item>
XSLT File
<xsl:for-each select="/root/node">
<xsl:variable name="itemName" select="@name"/>
<xsl:variable name="groupName" select="document($itemName)/item/group"/>
<xsl:value-of select="concat('Group ',$groupName)"/>
</xsl:for-each>
output
Group A Group B Group B Group C
Desired output
Group A Group B Group C
Here item 2 and 3 are of same group according to their group attribute so I have to only print the group name of any of them.
<xsl:key>
method works cross-document, but perhaps that's part of the answer. – cbeer