Hiya,
On 5/7/07, J. S. Rawat <jrawat(_at_)aptaracorp(_dot_)com> wrote:
Would anybody let me know that how to merge multiple xml files within a
directory into a single XML file. I have no idea about it.
Several ways of doing it;
a) Scripting language : create array of input files, read them in,
locate all the <record> elements (and content), and dump them all out
in a file containing the surrounding <records> element.
b) XSLT :
<xsl:template match="/">
<xsl:variable name="a" select="document('a.xml')/records" />
<xsl:variable name="b" select="document('b.xml')/records" />
<xsl:variable name="c" select="document('c.xml')/records" />
<records>
<xsl:copy-of select="$a/text()|$a/*" />
<xsl:copy-of select="$b/text()|$b/*" />
<xsl:copy-of select="$c/text()|$c/*" />
</records>
</xsl:template>
or a more dyunamic version with an XML input, or XSLT 2.0 with
embedded XML. If you need some special sort-order you need to tweakit
a bit.
c) with DTD's.
And I'm sure there's more.
Alex
--
---------------------------------------------------------------------------
Project Wrangler, SOA, Information Alchymist, UX, RESTafarian, Topic Maps
------------------------------------------ http://shelter.nu/blog/ --------
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--