I am looking for a solution to delete all duplicates from an XML file not based on Exact node name, Instead, I am looking for a solution that can identify all the duplicate nodes and delete them. Only the first node should exist, and the rest of the duplicate nodes to be deleted.
I read couple of similar posts:
XSL - remove the duplicate node but keep the original
Removing duplicate elements with XSLT
Example:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<projects>
<project id="staticproperties">
<property name="prop1">removing this prop if its duplicate</property>
<property name="prop2">removing this prop if its duplicate</property>
<property name="prop3">removing this prop if its duplicate</property>
<property name="prop4">removing this prop if its duplicate</property>
</project>
<project id="febrelease2013">
<property name="prop">testing prop from pom.xml</property>
<property name="prop1">removing this prop if its duplicate</property>
<property name="prop3">removing this prop if its duplicate</property>
<property name="prop1">removing this prop if its duplicate</property>
<property name="prop5">removing this prop if its duplicate</property>
</project>
</projects>
NOTE: <property name="**could be any thing**">
Desired Output is:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<projects>
<project id="staticproperties">
<property name="prop1">removing this prop if its duplicate</property>
<property name="prop2">removing this prop if its duplicate</property>
<property name="prop3">removing this prop if its duplicate</property>
<property name="prop4">removing this prop if its duplicate</property>
</project>
<project id="febrelease2013">
<property name="prop">testing prop from pom.xml</property>
<property name="prop5">removing this prop if its duplicate</property>
</project>
</projects>