Convert one xml to another XSLT
Hi,
I want to convert xml in one format into another xml format shown below using java or any utility which can be used with JAVA (like XSLT)
Input xml :
<Name>
<Name1>
<Name11>Name11</Name11>
<Name12>Name12</Name12>
</Name1>
<Name1>
<Name11>Name21</Name11>
<Name12>Name22</Name12>
</Name1>
<Name2>
<Name1>
<Name11>Name11</Name11>
<Name12>Name12overRide</Name12>
</Name1>
<Name3>
<Name31>Name3Override</Name31>
</Name3>
</Name2>
<Name3>
<Name31>Name3Origional</Name31>
</Name3>
<Name3>
<Name32>Name3Origional</Name32>
</Name3>
</Name>
Output xml
<Name>
<Name1>
<Name11>Name11</Name11>
<Name12>Name12overRide</Name12>
</Name1>
<Name1>
<Name11>Name21</Name11>
<Name12>Name22</Name12>
</Name1>
<Name2>
</Name2>
<Name3>
<Name31>Name3Override</Name31>
</Name3>
<Name3>
<Name32>Name3Origional</Name32>
</Name3>
</Name>
Basically, Name2 tags stores Overriden information for the tag which are already present inside Name root tag.
i want generic template which does this replacing node based on pre - comparision.
i just know like Name2 is the only tag which stores overRiding information for Node's child tag.
Scenario :
1. While replacing \\Name\Name1 tag, i just know like i have to compare \\Name\Name2\Name1\Name11 with \\Name\Name1\Name11,
If this value matches, i need to replace \\Name\Name1 tag with \\Name\Name2\Name1 tag.
Also only \\Name\Name1 tag which satisfies this condition will replace, all other \\Name\Name1 tags remain same.
2. While replacing \\Name\Name3, i just know like i have to compare \\Name\Name2\Name3\Name31 with \\Name\Name3\Name31,
If this value matches, i just have to replace that \\Name\Name3 node with \\Name\Name2\Name3.
3. This replacing this should be cut paste kind of thing, not copy paste.
Please help me to find its solution,
Please Reply.

