How to maintain a global list to uniquely loop in XSLT

ion

New Member
I need to filter operation in some of the nodes which are duplicate (on a key)Following are my data file. data.xml\[code\]<root> <node name="item1" /> <node name="item2" /> <node name="item3" /> <node name="item4" /></root>\[/code\]in file item1.xml\[code\]<item> <group>A</group></item>\[/code\]item2.xml\[code\]<item> <group>B</group></item>\[/code\]item3.xml\[code\]<item> <group>B</group></item>\[/code\]item4.xml\[code\]<item> <group>D</group></item>\[/code\]XSLT File\[code\]<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> \[/code\]output\[quote\] Group A Group B Group B Group C\[/quote\]Desired output \[quote\] Group A Group B Group C\[/quote\]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.
 
Back
Top