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: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 15 Dec 2019 09:35:29 -0000
Am 15.12.2019 um 10:03 schrieb Trevor Nicholls trevor@xxxxxxxxxxxxxxxxxx:
>
> An application I am working on contains a large number of source
> documents which are all run through the same series of
> transformations. While initially the build process didn't take long
> the cost of repeatedly initialising the XSL processor soon adds up, so
> I am looking at ways to streamline it.
>
> Our processor of choice is Saxon (currently we are using 8.7.3) so I
> can shift this question to the Saxon list if there are extensions
> there that are relevant.
>
> So the question; given a script that essentially includes the following:
>
> cd documents
>
> for d in `cat dlist`; do
>
>   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
>
>   done
>
> done
>
> is there a mechanism which would allow a single Java process to
> perform the equivalent?
>

Well, writing a Java program that compiles that stylesheet once and then
calls Saxon repeatedly should be possible.

I don't know details about that very old Java version but in XSLT 3 and
Saxon 9.9 I would think that using uri-collection("?select=*") would
also allow you to have the XSLT code read in the different files and
process them. There is also the fn:transform function that allows you to
run XSLT from inside XSLT.

XProc might also be an option.

Current Thread