xsl-list
[Top] [All Lists]

Re: [xsl] Creating csv from multiple input files

2008-05-06 07:32:25
 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 :-)

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--