xsl-list
[Top] [All Lists]

[xsl] How to remove duplicate record from XML

2016-09-28 08:03:30
How to remove duplicate record from XML, my code is working fine, i am
deleting duplicate, but i need only that XML which is not duplicate.

*Input:*

<?xml version="1.0" encoding="UTF-8"?>
<Contact-data>
   <Contact>
      <id>074</id>
   </Contact>
   <Contact>
      <id>074</id>
   </Contact>
*   <Contact>*
*      <id>001</id>*
*   </Contact>*
</Contact-data>

*XSL:*

<xsl:stylesheet version="2.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform";>
    <xsl:output omit-xml-declaration="yes" indent="yes"/>
    <xsl:template match="/*">
        <xsl:for-each-group select="Contact" group-by="id">
            <xsl:sequence select="."/>
        </xsl:for-each-group>
    </xsl:template>
</xsl:stylesheet>

*ExpectedOutput:*

<Contact-data>
   <Contact>
      <id>001</id>
   </Contact>
</Contact-data>
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>