Re: [xsl] merging document from filelist

Subject: Re: [xsl] merging document from filelist
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 17 Dec 2004 18:00:58 -0500
Hello Victor,

At 05:11 PM 12/17/2004, you wrote:
can anyone advise how the list of multiple documents can be merged in one
"super document"?

Sure.


The document() function can take an entire node set as argument, returning an entire set of documents for processing.

So if you have

<filelist>
  <file>a.xml</file>
  <file>b.xml</file>
  <file>c.xml</file>
</filelist>

then document(/filelist/file) will parse these files and pull them into a single node set, which you can process as if it were a normal source file.

Recursion is not needed.

If all you want to do is aggregate them, you could simply have:

<xsl:template match="filelist">
  <collection>
    <xsl:copy-of select="document(file)"/>
  </collection>
</xsl:template>

or use document(file,/) if the file references are relative to the listing, not to the stylesheet.

See more on all this and more at http://www.dpawson.co.uk/xsl/sect2/N2602.html. And let us know if this isn't sufficient to get you where you need to go.

Good luck,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

Current Thread