Re: [xsl] Running the same transformation on many input files, optimisation possible?

Subject: Re: [xsl] Running the same transformation on many input files, optimisation possible?
From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 15 Dec 2019 17:37:11 -0000
On Sun, Dec 15, 2019 at 09:03:01AM -0000, Trevor Nicholls trevor@xxxxxxxxxxxxxxxxxx scripsit:
> Our processor of choice is Saxon (currently we are using 8.7.3) so I can

Why are you using something that old?  (It's not quite like saying "we
use K&R C!" but it's heading there.)

[snip]
> is there a mechanism which would allow a single Java process to
> perform the equivalent?

One approach to this problem is to use a single containing XSLT
transform which loads all the files (either via EXSLT file extensions or
via the collection() function) and processes them one at a time through
a series of variables, $pass1, $pass2, etc. using XSLT transforms with
modes firstPass, secondPass, etc. to create the variables.

This has the advantage of only needing to start one transformation, so a
single Java process; it does require you to use at least XSLT 2 to get
the "I can assign the result of apply-templates to a variable in this
useful way" functionality.

Especially if you might need to add more steps later, this kind of
chained processing is a useful design pattern for "I have a bunch of
source documents to be treated the same way" processing.

-- Graydon

Current Thread