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

Command line

If you are running XSpec on the command line:

  1. 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"
  1. Run the XSpec tests as usual.

Ant

If you are running XSpec via Ant:

  1. Download a version-specific schxslt-...-xslt-only.zip package from the SchXslt release page and extract it into an empty directory.

  2. In your ant command, specify the three Ant properties with xspec.schematron.preprocessor. in their names, as follows. The syntax assumes you downloaded version 1.9.5 to a directory named C:\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:

  1. Download a version-specific schxslt-...-xslt-only.zip package from the SchXslt release page and extract it into an empty directory.

  2. 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"
  1. 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.

  1. Download the skeleton implementation from https://github.com/Schematron/schematron/tree/2020-10-01/trunk/schematron/code and place it in an empty directory.

  2. 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"