I need to transform this XML input:
<root>
<node id="a">
<section id="a_1" method="run">
<item id="0" method="a">
<attribute>
<color>Red</color>
<status>1</status>
<condition>good</condition>
</attribute>
</item>
<item id="0" method="a">
<attribute>
<color>Red</color>
<status>1</status>
<condition>good</condition>
</attribute>
</item>
</section>
<section id="a_2" method="run">
<item id="0" method="a">
<attribute>
<color>Red</color>
<status>1</status>
<condition>good</condition>
</attribute>
</item>
</section>
</node>
<node id="b">
<section id="b_1" method="create">
<user id="b_1a" method="x">
<attribute>
<origin>us</origin>
</attribute>
</user>
<user id="b_1a" method="x">
<attribute>
<origin>us</origin>
</attribute>
</user>
<user id="b_1b">
<attribute>a</attribute>
</user>
</section>
<section id="b_2">
<user id="b_1a" method="x">
<attribute>
<name>John</name>
<origin>us</origin>
</attribute>
</user>
</section>
</node>
</root>
Here is the expected output:
<root>
<node id="a">
<section id="a_1" method="run">
<item id="0" method="a">
<attribute>
<color>Red</color>
<status>1</status>
<condition>good</condition>
</attribute>
</item>
</section>
<section id="a_2" method="run">
<item id="0" method="a">
<attribute>
<color>Red</color>
<status>1</status>
<condition>good</condition>
</attribute>
</item>
</section>
</node>
<node id="b">
<section id="b_1" method="create">
<user id="b_1a" method="x">
<attribute>
<origin>us</origin>
</attribute>
</user>
<user id="b_1b">
<attribute>a</attribute>
</user>
</section>
<section id="b_2">
<user id="b_1a" method="x">
<attribute>
<name>John</name>
<origin>us</origin>
</attribute>
</user>
</section>
</node>
</root>
Note: the duplicate means all the child/children is having the same value, the node can have 1 or more children as long as it is the same parent (id and method are the same) and we can assume that it always in the same section (id and method are the same).
is this possible to be done? please enlighten me
Thanks very much.
cheers, John