Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > merge of 2 xml files

Reply
Thread Tools

merge of 2 xml files

 
 
John Huntjens
Guest
Posts: n/a
 
      09-14-2003
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"
xmlnssl="http://www.w3.org/1999/XSL/Transform">

<xslutput 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Merge two different xml files into one Kjetil Finsrud XML 0 11-23-2004 09:20 AM
XML transfrom: merge 2 or more different XML file into one Jacinle Young XML 3 06-28-2004 01:20 AM
[Ant] Merge two xml files Eirik Eldorsen XML 1 04-12-2004 05:02 PM
Merge two xml files on common date field and write out tab-delimited file Luke Airig XML 0 12-21-2003 08:00 PM
merge two xml files based on common key Luke Airig XML 1 12-16-2003 07:36 PM



Advertisments