This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: multiple input files to one output file


If you can use Saxon for your application, take a good long look at the
docs for both the extension facilities and the API.  For a large set of
data like this it will probably be worth writing a Java program which
caches the stylesheet and applies it to the list of files.

You could either use Java's directory walking routines to generate the
file list, or have two stylesheets in your Java app.  The first could
process the XML files to extract the filenames/URLs; you could capture
the output of that internally, and then use it to drive the iteration of
the second sheet.

 Steve

Eric van der Vlist wrote:
> Linda is mentioning "thousands of files"...
> It may be worthwhile to check that the files are closed and the
> resources released for each iteration of the for-each loop.
> Do you know if it's the case ?
>
> Mike Brown wrote:
> >
> > > I do have XML files that specify the filenames and paths of all the
> > > documents in a specific subdirectory. Could I somehow read such a
> > > filenames-file and call the document function for each of the
> > > files listed, and then extract the information I want from each
> > > document?
> >
> > <xsl:for-each select="document('filenames_file.xml')/someURIs/file/text()">
> >   <xsl:variable name="current_file_root" select="document(string(.))"/>
> >   <!-- the next lines are just for example -->
> >   <xsl:text>&#xA;&#xA;current file: </xsl:text>
> >   <xsl:value-of select="."/>
> >   <xsl:text>&#xA;# of elements: </xsl:text>
> >   <xsl:value-of select="count($current_file_root//*)"/>
> > </xsl:for-each>
> >

-- 
----------------------------------------------------------------------
Steve Tinney                                        Babylonian Section
                                 *   University of Pennsylvania Museum
stinney@sas.upenn.edu                          Phila, PA. 215-898-4047


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]