Posted: Thu Oct 02, 2003 12:54 pm Post subject: XML transformation using REFERENCE
Novice
Joined: 24 Jul 2003 Posts: 19
Hi,
I have the following input xml to be transformed to below output xml.
1.Parent to Child transformation as seen on output for the underscore elements.
2.Moving the Root <abc> </abc> into <cde> </cde>
Code:
I/P Part of the XML which needs to be transformed
<abc>
<xxx>21</xxx>
<yyy>22</yyy>
<cde>
<mmm>
<efg>
<* please do not use *>23</* please do not use *>
<aaa_vvv>25</aaa_vvv>
<bbb_yyy>26</bbb_yyy>
<ccc>27</ccc>
</efg>
<ghi>
<ddd>28</ddd>
<eee_zzz>29</eee_zzz>
<eee_www>30</eee_www>
<fff_ppp>31</fff_ppp>
</ghi>
</mmm>
</cde>
</abc>
O/P Part of the XML which needs to be transformed
<cde>
<mmm>
<efg>
<aaa>
<* please do not use *>23</* please do not use *>
<vvv>25</vvv>
</aaa>
<bbb>
<yyy>26</yyy>
</bbb>
<ccc>25</ccc>
</efg>
<ghi>
<ddd>23</ddd>
<eee
<zzz>29</zzz>
<www>30</www>
</eee>
<fff
<ppp>31</ppp>
</fff>
</ghi>
<abc>
<xxx>21</xxx>
<yyy>22</yyy>
<abc>
</mmm>
</cde>
I would appreciate your hints how I can move from siblings to Root.I have seen examples of moving within same siblings and I assume that I wil be needing 2 while loops to accomplish this..
1.Parent to child transformation
The elements with underscore can be done as you suggested if there are 'n' number of siblings under the parent.How will I move to next parent and look for 'n' siblings???
2.Moving Root
I did try to do it but it copies the entire tree under <abc>.However I would like to copy only the children i,e <xxx>,<yyy> within the <mmm> parent as the last child.
I would appreciate your response or anyone out there who have implemented complex transformation.The format of message is self explanatory.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum