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

Re: Running the same transformation on many input file

Subject: Re: Running the same transformation on many input files, optimisation possible?
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 15 Dec 2019 19:31:12 -0000
Re:  Running the same transformation on many input file
On Sun, 2019-12-15 at 09:03 +0000, Trevor Nicholls
trevor@xxxxxxxxxxxxxxxxxx wrote:
> 
> cd documents
> 
> for d in `cat dlist`; do

as others have said, use collection, or unparsed-text-lines() to read
dlist;

> 
>   cd $d
> 
>   for f in `cat flist`; do
> 
>     java -jar $SAXONDIR/saxon8.jar  -o  $f.new.xml  $f.xml
> $SCRIPTDIR/transform.xsl  doc=$d  file=$f

This is super easy with fn:transform() and really fast too. In a recent
course i gave, people with laptops read an input XML file and split it
into over 9,000 HTML files with transform(), the entire process taking
roughly 6 seconds to run with Saxon for most of them, both fromthe
command-line and inside Oxygen XML Editor.

Watch that the parameters you pass with f:transformmust be QNames -use
QName('', 'doc) for example.

There's no easy way to change directory in Java, although you can do
that with a Saxon extension i think -   calling the Java method:
  System.setProperty("user.dir", "/some/directory")
might do it. The EXpath file:current-dir() function tells you where you
are.

So this approach would involve modifying the XSLT stylesheets you call
so that they take a dir parameter or use file:current-dir(). Watch that
Saxon on Windows might not include a drive letter with current-dir(),
which may or nay not matter to you.


Liam

-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org

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.