0

I plan to use Saxon for an XSLT problem. I need to run my program on a schedule. When it runs it needs to select all CSV files from a directory. The number of files can be random but once processed they are cleared from the folder by another process. Originally there was only one CSV file with a fixed name so referencing it in the XSLT wasn’t a problem. I could also programmatically set the filename at runtime so all was working well. My XSLT now needs to know about all the files so I can output a single XML. I’m not sure if I can pass in a file path and let the XSLT read in all the files at that location? Is there a command to do this or is there a better way to do this? Remember I don’t know how many CSV files will be in the folder when the XSLT is run.

4

1 に答える 1

1

www.saxonica.com/documentation/sourcedocs/intro.xmlを参照してください。この関数を使用してcollection、ディレクトリからファイルを読み込むことができます。

<xsl:for-each select="collection('file:///C:/dir/subdir?select=*.csv;unparsed=yes')/tokenize(., '\n')">
  <line><xsl:value-of select="."/></line>
</xsl:for-each>
于 2012-06-15T13:49:09.103 に答える