It was very difficult for me to program XSLT to bring me the desired result.
Here is my XML input that I am testing on ..
<aaa id="1"> <bbb id="2">text1</bbb> <ccc>text2</ccc> <ddd id="3"> <eee att="4d">text3</eee> <fff> <ggg att="3d"> <yyy>text4</yyy> <iii attr="jj"/> </ggg> </fff> <sss> <ttt info="Y"> <nnn delete="N"> <mmm>text5</mmm> </nnn> </ttt> </sss> </ddd> </aaa>
Desired Result:
<root> <aaa id="1"/> <bbb id="2">text1</bbb> <ccc>text2</ccc> <ddd id="3"/> <eee att="4d">text3</eee> <fff/> <ggg att="3d"/> <yyy>text4</yyy> <iii attr="jj"/> <sss/> <ttt info="Y"/> <nnn delete="N"/> <mmm>text5</mmm> </root>
I can not write generalized code. I mean, my code should be able to provide similar output for different XML files with different tag names.
source share