Remove duplicate subcategory block items from xml

chandni chauhan
    <category link-id="681" link-handle="package-products" value="Package products">
        <entry id="1077" images="1" products="1" brands="1">
            <sub-category>
                <item handle="pens">Pens</item>
                <item handle="refills-pens">Refills : Pens</item>
            </sub-category>
        </entry>
        <entry id="1075" images="1" products="1" brands="1">
            <sub-category>
                <item handle="pencil">Pencil</item>
                <item handle="refills-pencil">Refills : Pencil</item>
            </sub-category>
        </entry>
        <entry id="1073" images="1" products="1" brands="1">
            <sub-category>
                <item handle="pencil">Pencil</item>
                <item handle="refills-pencil">Refills : Pencil</item>
            </sub-category>
        </entry>
        <entry id="1050" images="1" products="1" brands="1">
            <sub-category>
                <item handle="marker">Marker</item>
                <item handle="refills-marker">Refills : Marker</item>
            </sub-category>
        </entry>

I want to remove duplication of 3rd block from sub category for output. Please help me on this. I want output as :

Pens

Refills : Pens

Pencil

Refills : Pencils

Marker

Refills : Marker
Rudramuni TP

Try This: (XSLT version 2)

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="kItemHandle" match="entry" use="sub-category/item"/>

<xsl:template match="node()|@*">
    <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
</xsl:template>

<xsl:template match="category">
    <xsl:for-each select="entry[count(. | key('kItemHandle', sub-category/item[1])[1])=1]">
        <xsl:value-of select="sub-category/item[1]"/>
        <xsl:text>&#xa;</xsl:text>
        <xsl:value-of select="sub-category/item[2]"/><xsl:text>&#xa;</xsl:text>
    </xsl:for-each>
</xsl:template>

</xsl:stylesheet>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Remove duplicate items from KeyValuePair List by Value

From Java

Efficient way to remove half of the duplicate items in a list

From Dev

Remove duplicate tuples from a list if they are exactly the same including order of items

From Dev

Remove duplicate items from S3 objects multi dimension array in php

From Dev

Remove items from array

From Dev

How can I remove duplicate, invalid, child nodes from an XML document using Linq to XML?

From Dev

Python remove duplicate elements from xml tree

From Dev

remove duplicate xml elements from doc builder list in java

From Dev

Remove Duplicate Items From Multidimensional Array Using Javascript, jQuery, & underscore.js

From Dev

Remove XML duplicate items in Excel using VBA

From Dev

How to remove duplicate XML declaration

From Dev

Remove duplicate items from a LinkedList, where the nested collection items can be in any order

From Dev

Java SQL String remove duplicate items in GROUP BY

From Dev

Remove Duplicate Captures from List

From Dev

Remove Duplicate XML Nodes in PowerShell

From Dev

How do I remove duplicate notes from an XML document in Perl?

From Dev

Remove Duplicate Record from XML file using XLST

From Dev

Remove items from array to ensure no duplicate strings

From Dev

Remove duplicate items from S3 objects multi dimension array in php

From Dev

Remove Items From XML Based Off Date

From Dev

Remove Duplicate values from a list while keeping track of the removed items' indexes

From Dev

Python remove duplicate elements from xml tree

From Dev

Remove Duplicate XML Records

From Dev

Java SQL String remove duplicate items in GROUP BY

From Dev

Remove Duplicate XML Nodes in PowerShell

From Dev

How to remove the duplicate nodes from xml using xslt

From Dev

Remove duplicate items by value from a dictionary

From Dev

Using a callback to remove duplicate items from an array

From Dev

Remove items from ObservableConcurrentCollection

Related Related

  1. 1

    Remove duplicate items from KeyValuePair List by Value

  2. 2

    Efficient way to remove half of the duplicate items in a list

  3. 3

    Remove duplicate tuples from a list if they are exactly the same including order of items

  4. 4

    Remove duplicate items from S3 objects multi dimension array in php

  5. 5

    Remove items from array

  6. 6

    How can I remove duplicate, invalid, child nodes from an XML document using Linq to XML?

  7. 7

    Python remove duplicate elements from xml tree

  8. 8

    remove duplicate xml elements from doc builder list in java

  9. 9

    Remove Duplicate Items From Multidimensional Array Using Javascript, jQuery, & underscore.js

  10. 10

    Remove XML duplicate items in Excel using VBA

  11. 11

    How to remove duplicate XML declaration

  12. 12

    Remove duplicate items from a LinkedList, where the nested collection items can be in any order

  13. 13

    Java SQL String remove duplicate items in GROUP BY

  14. 14

    Remove Duplicate Captures from List

  15. 15

    Remove Duplicate XML Nodes in PowerShell

  16. 16

    How do I remove duplicate notes from an XML document in Perl?

  17. 17

    Remove Duplicate Record from XML file using XLST

  18. 18

    Remove items from array to ensure no duplicate strings

  19. 19

    Remove duplicate items from S3 objects multi dimension array in php

  20. 20

    Remove Items From XML Based Off Date

  21. 21

    Remove Duplicate values from a list while keeping track of the removed items' indexes

  22. 22

    Python remove duplicate elements from xml tree

  23. 23

    Remove Duplicate XML Records

  24. 24

    Java SQL String remove duplicate items in GROUP BY

  25. 25

    Remove Duplicate XML Nodes in PowerShell

  26. 26

    How to remove the duplicate nodes from xml using xslt

  27. 27

    Remove duplicate items by value from a dictionary

  28. 28

    Using a callback to remove duplicate items from an array

  29. 29

    Remove items from ObservableConcurrentCollection

HotTag

Archive