Using Another Implementation of Schematron - xspec/xspec GitHub Wiki
Schematron is a standard that has multiple implementations. XSpec includes a Schematron implementation as part of the XSpec package.
- Through v2.3.2, XSpec includes the skeleton implementation.
- Starting in v3.0.3, XSpec includes the SchXslt implementation instead of the skeleton implementation.
This page describes how you can make XSpec use certain implementations of Schematron other than the built-in one.
- Using SchXslt with XSpec v2.3.2 and earlier
- Using a different SchXslt version with XSpec v3.0
- Using skeleton implementation with XSpec v3.0 (not supported)
Using SchXslt with XSpec v2.3.2 and earlier
Command line
If you are running XSpec on the command line:
- Set three environment variables, as follows. The URLs assume you want to use version 1.9.5 of SchXslt.
C:\test>set "SCHEMATRON_XSLT_INCLUDE=https://github.com/schxslt/schxslt/raw/v1.9.5/core/src/main/resources/xslt/2.0/include.xsl"
C:\test>set "SCHEMATRON_XSLT_EXPAND=https://github.com/schxslt/schxslt/raw/v1.9.5/core/src/main/resources/xslt/2.0/expand.xsl"
C:\test>set "SCHEMATRON_XSLT_COMPILE=https://github.com/schxslt/schxslt/raw/v1.9.5/core/src/main/resources/xslt/2.0/compile-for-svrl.xsl"
- Run the XSpec tests as usual.
Ant
If you are running XSpec via Ant:
-
Download a version-specific
schxslt-...-xslt-only.zip
package from the SchXslt release page and extract it into an empty directory. -
In your
ant
command, specify the three Ant properties withxspec.schematron.preprocessor.
in their names, as follows. The syntax assumes you downloaded version 1.9.5 to a directory namedC:\schxslt-1.9.5-xslt-only\
.
C:\test>ant -buildfile "...\build.xml" -lib "...\saxon-he-12.4.jar" -Dtest.type=s -Dxspec.xml="...\my-test.xspec" -Dxspec.schematron.preprocessor.step1="C:\schxslt-1.9.5-xslt-only\schxslt-1.9.5\2.0\include.xsl" -Dxspec.schematron.preprocessor.step2="C:\schxslt-1.9.5-xslt-only\schxslt-1.9.5\2.0\expand.xsl" -Dxspec.schematron.preprocessor.step3="C:\schxslt-1.9.5-xslt-only\schxslt-1.9.5\2.0\compile-for-svrl.xsl"
"Run XSpec Test" transformation scenario in Oxygen
If you are running XSpec using the Run XSpec Test transformation scenario:
-
Download a version-specific
schxslt-...-xslt-only.zip
package from the SchXslt release page and extract it into an empty directory. -
Clone the Oxygen transformation scenario. On the Options tab, set the transformation scenario dialog's Additional Ant arguments field to a value like the following. The value below assumes you downloaded version 1.9.5 to a directory named
C:\schxslt-1.9.5-xslt-only\
.
-Dxspec.schematron.preprocessor.step1="C:\schxslt-1.9.5-xslt-only\schxslt-1.9.5\2.0\include.xsl" -Dxspec.schematron.preprocessor.step2="C:\schxslt-1.9.5-xslt-only\schxslt-1.9.5\2.0\expand.xsl" -Dxspec.schematron.preprocessor.step3="C:\schxslt-1.9.5-xslt-only\schxslt-1.9.5\2.0\compile-for-svrl.xsl"
- Run your XSpec test with the cloned transformation scenario instead of the original one.
Using a different SchXslt version with XSpec v3.0
Follow the instructions above, using your preferred version of SchXslt.
This repository generally tests XSpec against the latest SchXslt version and does not guarantee compatibility with other SchXslt versions. However, if SchXslt releases a newer version before the next XSpec version is released, the instructions can help you use the latest SchXslt in your work.
Using skeleton implementation with XSpec v3.0 (not supported)
Using the skeleton implementation with XSpec v3.0 is neither recommended nor supported. However, this procedure is offered in case you need to use the skeleton implementation during troubleshooting or to match other parts of your tool chain that still use the skeleton implementation.
-
Download the skeleton implementation from https://github.com/Schematron/schematron/tree/2020-10-01/trunk/schematron/code and place it in an empty directory.
-
Modify step 2 of the Ant or Oxygen instructions above, using the following values for the Ant properties. The paths assume you placed the skeleton implementation files in
C:\iso-schematron\
.
-Dxspec.schematron.preprocessor.step1="C:\iso-schematron\iso_dsdl_include.xsl" -Dxspec.schematron.preprocessor.step2="C:\iso-schematron\iso_abstract_expand.xsl" -Dxspec.schematron.preprocessor.step3="C:\iso-schematron\iso_svrl_for_xslt2.xsl"