SchXslt2 Schematron to XSLT 3.0 transpiler

MarkupUK · 5.–7. June 2025 · London

SchXslt2 in a Nutshell

SchXslt2 is an XSLT program that transforms an ISO Schematron schema to an XSLT program for validation.

The validation program generates a validation report expressed in the Schematron Validation Reporting Language (SVRL).

SchXslt2 is the second iteration of a modern XSLT-based ISO Schematron implementation.

A very brief history

The first iteration (aptly called SchXslt) was released in 2018 and is currently at version 1.10.1 released July 2024.

It is highly customizable wrt the reporting language, provides an XSLT 1.0 and a XSLT 2.0 implementation that support XSLT 1.0 and XSLT 2.0 as query language repectively.

With the release of SchXslt2 in October 2023 it effectivly went into maintenance mode: Bugs get fixed but no new features are added.

SchXslt2

It is a single-file transpiler that only uses XSLT 3.0 as implementation language and supported query language.

The report format is not customizable.

It is currently at version 1.3.5 released in June 2025.

Using SchXslt2

  1. Download a release from codeberg.org/schxslt/schxslt2 (i.e. schxslt2-v1.3.5.zip) and unpack to a directory of your liking.

  2. Transpile your schema to XSLT.

    saxon-transform ↩
     -xsl:transpile.xsl -o:schema.xsl -s:schema.sch \{http://dmaus.name/ns/2023/schxslt}debug=1
  3. Validate your document.

    saxon-transform -xsl:schema.xsl -s:document.xml -o:report.svrl

Transpiler options

schxslt:streamable
Set to boolean true to create a streamable validation stylesheet.
schxslt:expand-text
When set to boolean true, the validation stylesheet globally enables text value templates, and you may use them in assertion or diagnostic messages.

Transpiler options (continued)

schxslt:fail-early
When set to boolean true, the validation stylesheet stops as soon as it encounters the first failed assertion or successful report.
schxslt:terminate-validation-on-error
When set to boolean true, the validation stylesheet terminates the XSLT processor when it encounters a dynamic error.

Known limitations

SchXslt2 does not implement proper scoping rules of pattern and phase variables.

Schema, pattern, and phase variables are all implemented as global XSLT variables.

As a consequence, the name of a schema, pattern, or phase variable MUST be unique in the entire schema.

ISO Schematron 2025

Typed variables
sch:let/@as
OK
Global abstract rules
sch:rules
OK
Abstract pattern parameters
sch:pattern[@abstract = 'true']/sch:param
OK
Logging dynamic errors
svrl:error
OK

ISO Schematron 2025 (continued)

Restrict evaluation of pattern to subset of document
sch:phase/@from
WIP
Grouping rules w/o if-then-else behavior
sch:group
WIP
Refine rule context
sch:rule/@visit-each
WIP
Select active phase based on instance document
sch:phase/@when
No

Select active phase based on instance document

ISO Schematron 2025 introduces an @when attribute on the phase element that selects a phase if the expression in this attribute evaluates to boolena true. The expression is evaluated with the instance document as context.

SchXslt2 transpiles for a specific phase.

Favoured solution: Keep the transpiler simple, write a Schematron processor that deals with variables and dynamic phase selection (project Mausotron).

Future plans

Implement most of the ISO 2025 features until the end of the year.

Thank you for listing