RE: [xsl] concatenating 1-n XML files

Subject: RE: [xsl] concatenating 1-n XML files
From: Jarno.Elovirta@xxxxxxxxx
Date: Tue, 12 Nov 2002 14:54:39 +0200
Hi,

> Problem: Customer has 1-n xml files with identical structure. 
> I want to
> merge them into 1 large xml and then transform that.
> 
> 1. Can I use the document() function with wildcards in the doc-name ?
> something like: <xsl:for-each select="document('name*.xml')"> ? 

Nope. Write a recursive template the goes throught 1 to n, and use document(concat('name', $i, '.xml')); or if the file names are more or less random, first generate a directory listing in XML, and then process every item in that.

> 2. If 1. works would  a large number of files (000's) have an 
> adverse effect
> on performance ? Or once a document is processed is it 
> retained in memory or
> released ? Is there an upper limit of elements that can be 
> processed ? I'll
> be using xalan.

Naturally processing multiple documents has a cost. You should as Xalan users-list if a document is cached, or how caching can be switched off.
 
> If I can't use document like that any other suggestions or 
> anybody done
> anything similar ? Looking through the archives/FAQ's there 

Write a preprocessor on top of the parser, combining the documents there, and feed that SAX stream to Xalan, for example. But I see no reason why you cannot use document() with recursive templates.

Jarno - VNV Nation: Beloved

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread