SchXslt is copyright (c) 2018,2019 by David Maus <dmaus@dmaus.name> and released under the terms of the MIT license.
SchXslt is a conforming Schematron processor implemented entirely in XSLT. It operates as a three-stage transformation process that translates a Schematron to an XSLT validation stylesheet. This stylesheet outputs a validation report in the Schematron Validation Report Language (SVRL) when applied to an instance document.
With this respect it operates much like the "skeleton" implementation by Rick Jelliffe and others.
The description that follows comes from the original repository. Please read it in tandem with the comments on this revised version.
All external definitions referenced by sch:include and sch:extends are recursively copied into the source Schematron. The base URI of external definitions is preserved such that relative URI references still resolve to the right documents.
This step can be skipped if the Schematron does not reference external definitions.
The responsible stylesheet is include.xsl.
saxon -xsl:src/main/resources/xslt/2.0/include.xsl -o:stage-1.sch </path/to/schematron>
Abstract patterns and rules are instantiated.
This step can be skipped if the Schematron does not define abstract patterns or rules.
The responsible stylesheet is expand.xsl.
saxon -xsl:src/main/resources/xslt/2.0/expand.xsl -o:stage-2.sch stage-1.sch
Compiles an XSLT 2.0 validation stylesheet that creates an SVRL report document.
The responsible stylesheet is compile-for-svrl.xsl.
This stylesheet takes an optional argument 'phase' to validate in the selected phase. If no phase is requested the value of the @defaultPhase attribute is used if present. Otherwise, it defaults to phase '#ALL' and validates all patterns.
saxon -xsl:src/main/resources/xslt/2.0/compile-for-svrl.xsl -o:stage-3.xsl stage-2.sch [phase=myphase]
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/main/resources/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/main/resources/xproc/validate-with-schematron.xpl
SchXslt lets you customize the parts of the validation stylesheet that
report on active patterns, fired rule, failed assertions, and
successful reports. The compiler calls named templates in the
https://doi.org/10.5281/zenodo.1495494#api namespace that are
expected to create the part of the validation stylesheet that handles
respective reporting.
You can find the API documentation in the docs/api directory.
SchXslt comes with a set of https://github.com/xspec/xspec definitions that test internals of the processor (test/resources/impl) and SchXslt against the ISO specification (test/resources/spec).
The test runner relies on XProc XSpec and XSpec to be installed as Git submodules in the lib/ directory.
To execute the test suite run the runner with Calabash.
calabash src/test/resources/runner.xpl