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