RE: [xsl] Tool for transforming files in folder structures

Subject: RE: [xsl] Tool for transforming files in folder structures
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 6 Nov 2008 23:25:25 -0000
Saxon will handle this.

Use the collection() function to read the input files, in conjunction with
saxon:discard-document() to make sure that each file is discarded from
memory after processing. 

It would be something like

<xsl:template name="main">
  <xsl:for-each
select="collection('file:///c:/input-dir/?select=*.xml;recurse=yes')/discard
-document(.)">
    <xsl:result-document href="{replace(document-uri(.), '/input-dir/',
'/output-dir/')}"/>
      <xsl:apply-templates select="."/>
    </xsl:result-document>
  </xsl:for-each>
</xsl:template>

and then the template rules to do the transformation.

Michael Kay
http://www.saxonica.com/
    

> -----Original Message-----
> From: Stefan Krause [mailto:stf@xxxxxxxx] 
> Sent: 06 November 2008 23:23
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Tool for transforming files in folder structures
> 
> Hello,
> 
> I have to transform a set of about 120000 files in a nested 
> folder structure (about 8000 Directories). I need a tool, 
> which transforms these files (all by the same stylesheet) and 
> recovers the folder tree in the output directory.
> 
> Any suggestions?
> 
> 
> Stefan Krause

Current Thread