XML.com

Initial release of SchXslt, a new XSLT Schematron processor

November 27, 2018

Submitted by David Maus.

SchXslt [ʃˈɛksl̩t] is a recent implementation of an XSLT-based Schematron processor. It allows you to perform ruled based validation of XML documents as defined in the Schematron specification.

SchXslt follows the principle design of Rick Jelliffe's skeleton implementation and translates an ISO Schematron to an XSLT stylesheet that outputs a report in the Schematron Validation Report Language (SVRL).

It differs from the skeleton implementation as follows:

  • only supports XSLT 2.0 as query language binding and requires an XSLT 2.0 processor for stylesheet translation;
  • only implements features defined in the Schematron specification; e.g. SchXslt does not support other inclusion mechanisms than sch:include and sch:extend;
  • does not provide hooks or other customization options (yet);
  • performs base URI fixup of included external definitions.

To use SchXslt you first have to subsequently apply the transformations include.xsl, expand.xsl, and compile.xsl to your Schematron. If you want to compile a validation stylesheet for a specific phase you can pass the name of the phase to the last step as phase parameter.

saxon -xsl:src/xslt/include.xsl -o:stage-1.sch </path/to/schematron>
saxon -xsl:src/xslt/expand.xsl -o:stage-2.sch stage-1.sch
saxon -xsl:src/xslt/compile.xsl -o:stage-3.xsl stage-2.sch [phase=myphase]

The last transformation creates an XSLT stylesheet that you can apply to an XML file. With an XProc 1.0 processor installed you can create the validation stylesheet with the step compile-schematron.xpl.

calabash -i </path/to/schematron> -o:stage-3.xsl src/xproc/compile-schematron.xpl

Lastly, SchXslt comes with another XProc step validate-with-schematron.xpl that performs schematron validation using SchXslt's stylesheets. To run it from the command line you have to pipe the document to validate in the input port source, and the Schematron in the input port schema. The step sends the validation report to the result output port.

calabash -i source=</path/to/document> -i schema=</path/to/schema> src/xproc/validate-with-schematron.xpl

Version 1.0-rc2 is available for download. The author is interested in getting feedback, especially about how SchXslt performs compared to the skeleton implementation.


News items may be commercial in nature and are published as received.