[xsl] XSLT to conver flat XML to Heirarchy XML

Subject: [xsl] XSLT to conver flat XML to Heirarchy XML
From: <sreekanth.gangula@xxxxxxxxx>
Date: Wed, 27 Apr 2005 08:24:29 +0530
Hi ,
>  I have an XML which is flat,
>
><?xml version="1.0" encoding="utf-8" ?>
>
><ns:MT_Test xmlns:ns="<http://centrica/Test>http://Centrica/Test";>
>  <RECSETNAME xmlns:ns="<http://centrica/Test>http://Centrica/Test";>
>    <Record>
>        <keyfieldValue>"HEADR"</keyfieldValue>
>        <fieldValue>"CDJOB"</fieldValue>
>        <fieldValue>"TRA"</fieldValue>
>    </Record>
>
>    <Record>
>        <keyfieldValue>"TRANS"</keyfieldValue>
>        <fieldValue>"DATA"</fieldValue>
>        <fieldValue>"EXCHG"</fieldValue>
>        <fieldValue>"EXCH"</fieldValue>
>    </Record>
>
>    <Record>
>        <keyfieldValue>"MTPNT"</keyfieldValue>
>        <fieldValue>74842606</fieldValue>
>    </Record>
>
>    <Record>
>        <keyfieldValue>"ADDRS"</keyfieldValue>
>        <fieldValue>"MTRPT"</fieldValue>
>        <fieldValue>"BRITISH TELECOM"</fieldValue>
>    </Record>
>
>    <Record>
>        <keyfieldValue>"ASSET"</keyfieldValue>
>        <fieldValue>"INSTL"</fieldValue>
>        <fieldValue>"METER"</fieldValue>
>    </Record>
>
>    <Record>
>        <keyfieldValue>"METER"</keyfieldValue>
>        <fieldValue>"T"</fieldValue>
>    </Record>
>
>  </RECSETNAME>
></<ns:MT_Test>
>
>All the data is store under the record structure, based on the
>keyFieldValue i have to generate the target node.
>
>my Target XML should look like:
>
><HEADR>
>   <fieldValue>"CDJOB"</fieldValue>
>   <fieldValue>"TRA"</fieldValue>
>   <TRANS>
>     <fieldValue>"DATA"</fieldValue>
>     <fieldValue>"EXCHG"</fieldValue>
>     <fieldValue>"EXCH"</fieldValue>
>
>     <MTPNT>
>       <fieldValue>74842606</fieldValue>
>
>       <ADDRS>
>          <fieldValue>"MTRPT"</fieldValue>
>          <fieldValue>"BRITISH TELECOM"</fieldValue>
>       </ADDRS>
>
>       <ASSET>
>          <fieldValue>"INSTL"</fieldValue>
>          <fieldValue>"568"</fieldValue>
>
>          <METER>
>             <fieldValue>"T"</fieldValue>
>          </METER>
>       </ASSET>
>     <MTPNT>
>   </TRANS>
></HEADR>
>
>
>
>The logic for generating:
>
>   loop through the records in sorce xml,
>
>    Base on the key value generate the note in the tareget XML, The
>problem here is i am not sure how to insert the nodes as a children in
>the targt.
>
>
>
>Could anyone please help.
>
>
>
>Regards
>
>Sreekanth



Confidentiality Notice

The information contained in this electronic message and any attachments to
this message are intended
for the exclusive use of the addressee(s) and may contain confidential or
privileged information. If
you are not the intended recipient, please notify the sender at Wipro or
Mailadmin@xxxxxxxxx immediately
and destroy all copies of this message and any attachments.

Current Thread