xsl-list
[Top] [All Lists]

Re: [xsl] Using paramter "-s" with a diretcory = recursive for the whole dir tree?

2009-08-11 03:41:19
2009/8/11 Ben Stover <bxstover(_at_)yahoo(_dot_)co(_dot_)uk>:
When reading web page

http://www.saxonica.com/documentation/using-xsl/commandline.html

then there is said about the parameter "-s":
"If the name identifies a directory, all the files in the directory will
be processed individually."

Does that mean all files just in this directory?
What about files in sub-directories? Are they processed as well?

If not: How can I tell Saxon to process a whole directory tree recursively?


If you want 1 output file per input file, then you could use Kernow or
the technique below.  If you want 1 output for multiple input files,
then use the collection() function in a "standalone" transform (and
then run that using Kernow :)

<xsl:template name="main">
  <xsl:for-each select="for $x in collection(concat($input-dir,
'?select=*.xml;recurse=yes')) return saxon:discard-document($x)">
    process each file

The "recurse=yes" part tells Saxon to process sub-directories too.
The "saxon:discard-document()" part is needed if you have a to process
more XML in a single transform than you can fit into memory.

I use this so often I really hope there are new features in 2.1 for
processing directories of XML.


-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [xsl] Using paramter "-s" with a diretcory = recursive for the whole dir tree?, Andrew Welch <=