[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Creating csv from multiple input files
Hi, this question has been asked a few times in this list but i couldn't find an answer that works for me. I want to process multiple xml-files in one folder and write the output to one single file. My input files are very simple and look like this: <?xml version="1.0" encoding="ISO-8859-1" ?> <invdoc> <objid>3196575</objid> <cdate>15.02.2006</cdate> <user>Smith</user> </invdox> <?xml version="1.0" encoding="ISO-8859-1" ?> <invdoc> <objid>3196576</objid> <cdate>15.02.2006</cdate> <user>Doe</user> </invdox> My XSLT ist very simple too and should create a csv-file where the values are separated by tabulators: <?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/> <xsl:text>
</xsl:text> </xsl:result-document> </xsl:template> <xsl:template match="//objid"> <xsl:value-of select="concat(.,'	')"/> </xsl:template> <xsl:template match="//cdate"> <xsl:value-of select="concat(.,'	')"/> </xsl:template> <xsl:template match="//user"> <xsl:value-of select="."/> </xsl:template> </xsl:stylesheet> For a single file this works fine. But the supposed output after processing all files should be a single "result.csv" that looks like this: 3196575 15.02.2006 Smith 3196576 15.02.2006 Doe 4194550 07.03.2007 Smith Given that i don't know the number and names of the files in the input folder, how can i archive this result? I'm using Saxon8 for the tranformation but couldn't find out how to process multiple files on the command line. I also tried Kernow which makes it easy to pass a folder to saxon, but i didn't manage to create a single output file. It would be nice if someone could toss me to the right direction. Is there a pure XSLT-solution or do i have to use specific command-line options for saxon that i do not know? Georg.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|