Re: [xsl] Creating csv from multiple input files

Subject: Re: [xsl] Creating csv from multiple input files
From: "Georg Hohmann" <georg.hohmann@xxxxxxxxx>
Date: Tue, 6 May 2008 16:31:50 +0200
>  So you could use
>   <xsl:apply-templates
> select="collection('file:///C:/dir/subdir?select=*.xml')/*/*"/>
>  to process all child elements of all root elements of those .xml files in
> the directory C:\dir\subdir.

Thanks for the answer.
Following your advice i modified my stylesheet like this:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output name="csv" method="text" encoding="UTF-8"/>
  <xsl:template match="/">
     <xsl:result-document format="csv" href="result.csv">
        <xsl:apply-templates
select="collection('data/input?select=*.xml')/*/*"/>
        <xsl:text>&#x0d;&#x0a;</xsl:text>
     </xsl:result-document>
  </xsl:template>
...

"data/input" is the path relative to my xslt where the input files
resist. Now i wonder how i should run saxon9 from the command line.
Saxon9 needs an input file, but now the input files are all defined
inside the stylesheet. I was thinking of something like this:

java -jar saxon9.jar xml2csv.xslt

But this does not work due to the lack of an input file.
Could you please help a bit further?

Georg.

P.S.: Meanwhile i will generate a simple shell script like Wendell suggested.
That is the most obviously approach that i didn't thought of.
Sometimes too much xslt makes me blind :-)

Current Thread