xsl-list
[Top] [All Lists]

Re: [xsl] How to merge multiple XML files

2007-05-07 02:24:40
Colin Paul Adams wrote:
"Abel" == Abel Braaksma <abel(_dot_)online(_at_)xs4all(_dot_)nl> writes:

    Abel> Please read the reply that George Cristian Bina sent you:
    Abel> you can use the fn:collection() function to your purpose in
    Abel> XSLT 2.0

But note that you must read the documentation for your specific XSLT
processor first, as although the function is standard, the meaning of
any particular URI is not.

Indeed. I tried it once with AltovaXML for instance, and couldn't find a way to make it work (and there's no documentation at all). But both Gestalt and Saxon have a well-documented way of collecting a directory.

One more thing I can think of: in XSLT 2.0, the meaning of the fn:document() function was expanded to accept a sequence of more than one value as its first argument, each being a URI. Of course, this won't help you when you do not know the names of the files up front, unless you can somehow give them as a parameter on the commandline:

document( ('one.xml', 'two.xml') )

will give you a sequence of two document nodes, one for 'one.xml' and one for 'two.xml'.

Suppose you'd have a space separated list of files from your directory in a parameter (you can do so with some trickery on the commandline of course), this should work to 'concatenate' all files in one output document:

<xsl:copy-of select="document( tokenize($filelist, ' ') )" />

Cheers,
-- Abel Braaksma



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

<Prev in Thread] Current Thread [Next in Thread>