View Single Post
  #16 (permalink)  
Old April 30th, 2018, 08:55 AM
Martin Honnen Martin Honnen is offline
Friend of Wrox
Points: 6,673, Level: 34
Points: 6,673, Level: 34 Points: 6,673, Level: 34 Points: 6,673, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2007
Location: Germany
Posts: 1,242
Thanks: 0
Thanked 244 Times in 243 Posts
Default

I managed to omit a crucial
..
in the key definition, now edited and corrected, the code would be
Code:
  <xsl:output indent="yes"/>
  <xsl:strip-space elements="*"/>
  
  <xsl:key name="dup" match="KeyFacts/Registration" use="concat(generate-id(..), '|', Country)"/>

  <xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>
  
  <xsl:template match="KeyFacts/Registration[not(generate-id() = generate-id(key('dup', concat(generate-id(..), '|', Country))[1]))]"/>
online at https://xsltfiddle.liberty-development.net/bFDb2BZ, that eliminates duplicates inside a "KeyFacts".

I am still not sure how "Fund" relates to that, given that the code sample you presented as the input has exactly one "Fund" and not two.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
Reply With Quote
The Following User Says Thank You to Martin Honnen For This Useful Post:
virgosaggi (April 30th, 2018)