[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Using paramter "-s" with a diretcory = recursive f

Subject: Re: Using paramter "-s" with a diretcory = recursive for the whole dir tree?
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Tue, 11 Aug 2009 08:40:53 +0100
Re:  Using paramter "-s" with a diretcory = recursive f
2009/8/11 Ben Stover <bxstover@xxxxxxxxxxx>:
> 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/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.