merge of 2 xml files

J

John Huntjens

Ive tried so many things that it drives me crazy: a want to merge / join 2
xml files like this:

merge.xml:

<?xml version="1.0"?>
<merge>
<appxml>testapp.xml</appxml>
<userxml>user.xml</userxml>
</merge>

testapp.xml:

<app name="testapp" lifetime="900">
<mainmenu>
<menu id="1" caption="test"/>
<menu id="2" caption="another test"/>
</mainmenu>
<forms>
<testform autosize="1"/>
<testform2 autosize="0"/>
</forms>
</app>

user.xml:

<app lifetime="100">
<mainmenu>
<menu id="2" caption="my test"/>
<menu id="3" caption="my menu"/>
</mainmenu>
<forms>
<testform2 autosize="1"/>
</forms>
</app>

the result must be:

<app name="testapp" lifetime="100">
<mainmenu>
<menu id="1" caption="test"/>
<menu id="2" caption="my test"/>
<menu id="3" caption="my menu"/>
</mainmenu>
<forms>
<testform autosize="1"/>
<testform2 autosize="1"/>
</forms>
</app>

What i have so far:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:eek:utput method="xml" version="1.0" encoding="utf-8" indent="yes"/>

<xsl:template match="merge" >

<xsl:variable name="app_xml" select="string(appxml)" />
<xsl:variable name="user_xml" select="string(userxml)" />

<xsl:call-template name="domerge">
<xsl:with-param name="app_nodes" select="document($app_xml)" />
<xsl:with-param name="user_nodes" select="document($user_xml)" />
</xsl:call-template>

</xsl:template>

<xsl:template name="domerge">
<!-- what the heck must be here? -->
</xsl:template>

</xsl:stylesheet>

Who can help, give a hint or a pointer?

Any help appriciated

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top