Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 07:10 AM
John Huntjens
Guest
 
Posts: n/a
Default merge of 2 xml files

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:output 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


 

Bookmarks

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles