tags:

views:

31

answers:

2

I am a fresh bee in xslt. i have time constraint where i have to deliver something very urgently. Could you please help me out. Thank you in advance.

I am pasting the xml samples below. Here is small explanation I have input.xml and output.xml. these both files need to be merged as they have different formats. both files need to be merged based on element "ID". output.xml need to merged inside input.xml. if the ID of an element in input.xml matches with element ID of output.xml then child elements of output.xml need to be merged before the end tag of the matched element in the input.xml.

If you have any questions please fire it back.

Input.xml

<Result ID="A">
<Comment> blah blah blah</Comment>
<aaa>111</aaa>
<a1> 000</a1>
<a2 ID="B>
<a2a>9iu</a2a>
<a23> kjf</a23>
<b ID="C">
<b1>k</b1>
</b>
<c>jjj</c>
<d ID="E">
<d12>ppp</d12>
<d23 ID="W"/>
</d>
<e ID="AA">
<d ID="G">
<d12>ppp</d12>
<d23 ID="O"/>
</d>
</e>
</Result>

output.xml

<Insert>
<mn ID="A">
<mn1>345</mn1>
<mn2>123</mn2>
</mn>
<no ID="C">
<op>09</op>
<io>89</io>
</no>
<ab ID="B">
<ab>jik</ab>
<dc>hdg</dc>
</ab>
</Insert>

Merged.xml (should like below)

<Result ID="A">
<Comment> blah blah blah</Comment>
<aaa>111</aaa>
<a1> 000</a1>
<a2 ID="B">
<a2a>9iu</a2a>
<a23> kjf</a23>
<b ID="C">
<b1>k</b1>
<op>09</op>
<io>89</io>
</b>
<c>jjj</c>
<d ID="E">
<d12>ppp</d12>
<d23 ID="W"/>
</d>
<ab>jik</ab>
<dc>hdg</dc>
</a2>
<e ID="AA">
<d ID="G">
<d12>ppp</d12>
<d23 ID="O"/>
</d>
</e>
<mn1>345</mn1>
<mn2>123</mn2>
</Result>

Please give me generic solution which is not dependent on the name of the elements inside xslt.

A: 

You'll find the answer here http://phpforms.net/tutorial/tutorial.html

PHP Form