Re: [xsl] XSLT for mergig XML fragments into the base XML

Subject: Re: [xsl] XSLT for mergig XML fragments into the base XML
From: Michael Müller-Hillebrand <mmh@xxxxxxxxxxxxx>
Date: Mon, 5 Sep 2011 10:29:04 +0200
Am 05.09.2011 um 04:17 schrieb Zeev Atlas:

> <myxmlincludetype1 filename="SOMEFILE1"/>
> <myxmlincludetype2 filename="SOMEFILE2" attributes.../>

Zeev,

As I had a similar thing on my table the last days the solution could be
something like this (this works in XSLT 1.0, as I had to use Xalan):

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

<xsl:template match="myxmlincludetype1 | myxmlincludetype2">
  <!-- copy the original element -->
  <xsl:copy>
    <xsl:apply-templates select="@*" />
  </xsl:copy>
  <!-- process the content of the external document -->
  <xsl:apply-templates select="document(@filename)" />
</xsl:template>

<!-- Identity template -->
<xsl:template match="@* | node()">
  <xsl:copy>
    <xsl:apply-templates select="@* | node()" />
  </xsl:copy>
</xsl:template>

</xsl:transform>

- Michael

--
_______________________________________________________________
Michael M|ller-Hillebrand: Dokumentation Technology
Adobe Certified Expert, FrameMaker
Consulting and Training, FrameScript, XML/XSL, Unicode
Blog [de]: http://cap-studio.de/

Current Thread