View Single Post
  #4 (permalink)  
Old April 28th, 2018, 11:57 AM
virgosaggi virgosaggi is offline
Authorized User
Points: 110, Level: 2
Points: 110, Level: 2 Points: 110, Level: 2 Points: 110, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2018
Posts: 16
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Martin Honnen View Post
Are you really restricted to XSLT 1.0?
In XSLT 2 you could use match="Registration[generate-id() = generate-id(key('kMapping', Country, ancestor::Fund)[1])]" or use for-each-group
---------------------------------
HI Martin

I have used following code for the xml filtering on duplicate. but out of 4 countries its displaying 2 countries which are duplicate per Fund

<FundFacts>
<KeyFacts>
<Registration>
<Country>AE</Country>
</Registration>
<Registration>
<Country>AE</Country>
</Registration>
<Registration>
<Country>AT</Country>
</Registration>
<Registration>
<Country>AT</Country>
</Registration>
<Registration>
<Country>TW</Country>
</Registration>
<Registration>
<Country>ZA</Country>
</Registration>
</KeyFacts>
</FundFacts>


<FundFacts>
<KeyFacts>
<Registration>
<Country>AE</Country>
</Registration>
<Registration>
<Country>AT</Country>
</Registration>
</KeyFacts>
</FundFacts>


<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>

Last edited by virgosaggi; April 28th, 2018 at 12:02 PM..
Reply With Quote