Hi Rory,

It is very easy to run XSLT transformations directly in BaseX.

BaseX has a built-in XSLT module for that.
By default it supports XSLT 1.0 standard.
If needed you can extend it up to XSLT 4.0 via Saxon.

First, you need to prepare a tiny XQuery file for that.\
It accepts two parameters:
- $input, to specify input XML file
- $stylesheet, to specify XSLT file

In my example the result output file gets calculated name with a specific 
suffix: "_output.xml"
But it could be a 3rd parameter too.

xquery_xslt.qy
==============================
declare variable $input as xs:string external;
declare variable $stylesheet as xs:string external;

let $output := substring-before($input, ".") || "_output.xml"
return xslt:transform($input, $stylesheet) -> file:write($output, .)

Second, launch XSLT transformation at the command prompt:
basex.bat -b $input="path/to/input.xml" -b $stylesheet="path/to/transform.xslt" 
"path/to/xquery_xslt.qy"

Regards,
Yitzhak Khabinsky

Reply via email to