Removing duplicate in XML using xslt not working


(KB) #1

Sample Data: XML

Fund111111 AE AE AT AT TW ZA Fund222222 AE AE IT IT TA ZA

XSLT:

<xsl:stylesheet version=“2.0” xmlns:xsl=“http://www.w3.org/1999/XSL/Transform”>
<xsl:output method=“xml” version=“2.0” encoding=“UTF-8” indent=“yes” omit-xml-declaration=“yes”/>
<xsl:strip-space elements="*"/>

<xsl:key name=“cc” match=“Registration” use=“Country”/>
<xsl:template match=“node()|@">
xsl:copy
<xsl:apply-templates select="node()|@
”/>
</xsl:copy>
</xsl:template>

<xsl:template match=“Registration[generate-id() = generate-id(key(‘cc’, Country, ancestor::Fund)[1])]”
/>
</xsl:stylesheet>


Output displayed

It is only showing distinct value of country which are duplicate

Fund111111 AE AT Fund222222 AE IT

desired output

Fund111111 AE AT TW ZA Fund222222 AE IT TA ZA

Any help would be much appreciated

thank you