Using Another Implementation of Schematron - xspec/xspec GitHub Wiki

Schematron is a standard that has multiple implementations. XSpec includes one or more Schematron implementations as part of the XSpec package.

XSpec version Schematron implementations
Through v2.3.2 Skeleton only
v3.0.3 through v3.2.2 SchXslt only
v3.3.1 through v3.4.3 XQS and SchXslt (For XQS support in v3.3.x, see instructions for the XProc 3 pipeline, run-schematron-xqs.xpl.)
v4.0 (upcoming) XQS and SchXslt2

This page describes how you can make XSpec use certain implementations of Schematron other than the built-in ones. Note that this repository generally tests XSpec against the latest versions of the built-in implementations and does not guarantee compatibility with other versions.

Using a different SchXslt2 version with XSpec v4.0 onward

This subsection applies to the upcoming XSpec v4.0 release.

First, download a version-specific schxslt2-....zip package from the SchXslt release page and extract it into an empty directory. It includes a file named transpile.xsl. Then, follow one of the procedures below, depending on how you are running XSpec. The examples assume you downloaded version 1.10.2 to a directory named C:\schxslt2-1.10.2\.

Command line

  1. Set the SCHXSLT2_TRANSPILER environment variable to the location of your SchXslt2 transpile.xsl file, such as C:\schxslt2-1.10.2\transpile.xsl.

  2. Run the XSpec tests as usual.

Ant

In your ant command, specify the xspec.schxslt2.transpiler Ant property as the location of your SchXslt2 transpile.xsl file. Example:

C:\test>ant -buildfile "...\build.xml" -lib "...\saxon-he-12.9.jar" -Dtest.type=s -Dxspec.xml="...\my-test.xspec" -Dxspec.schxslt2.transpiler="C:\schxslt2-1.10.2\transpile.xsl"

"Run XSpec Test" transformation scenario in Oxygen

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.

-Dxspec.schxslt2.transpiler="C:\schxslt2-1.10.2\transpile.xsl"

Using a different XQS version with XSpec v3.3 onward

First, download a version-specific Source code package from the XQS release page and extract it into an empty directory. Then, follow one of the procedures below, depending on how you are running XSpec. The examples assume you downloaded version 1.1.0 to a directory named C:\xqs-1.1.0\.

Command line

  1. Set the XQS_HOME_URI environment variable to an absolute URI of your XQS installation, ending with a final slash. Example: file:/C:/xqs-1.1.0/

  2. Run the XSpec tests as usual.

Ant

In your ant command, specify the xspec.xqs.home.uri Ant property as an absolute URI of your XQS installation, ending with a final slash. Example:

C:\test>ant -buildfile "...\build.xml" -lib "...\saxon-he-12.9.jar" -Dtest.type=s -Dxspec.xml="...\my-test.xspec" -Dxspec.xqs.home.uri="file:/C:/xqs-1.1.0/" -Dxspec.basex.classpath="C:\basex\BaseX.jar"

"Run XSpec Test" transformation scenario in Oxygen

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.

-Dxspec.xqs.home.uri="file:/C:/xqs-1.1.0/"

XProc

In your command, specify the xqs-home XProc option as a URI of your XQS installation, ending with a final slash. Example:

   java -cp "C:\xmlcalabash3\xmlcalabash-app-3.0.44.jar;C:\xmlcalabash3\extra\*" ^
        com.xmlcalabash.app.Main ^
        --config:src/xproc3/schematron-xqs/xmlcalabash3-config.xml ^
        --input:source=test/xqs/schematron-for-xqs-expect.xspec ^
        --output:result=test/xqs/schematron-for-xqs-expect-result.html ^
        src/xproc3/schematron-xqs/run-schematron-xqs.xpl ^
        xspec-home=file:///C:/xspec/ ^
        xqs-home=file:///C:/xqs-1.1.0/

Using SchXslt with XSpec v2.3.2 and earlier, or v4.0 onward

These versions do not have SchXslt built in, so you need to install it yourself and point XSpec to files in your installation. Follow one of the procedures below, depending on how you are running XSpec.

Command line

  1. Set three environment variables, as follows. The URLs assume you want to use version 1.10.1 of SchXslt.
C:\test>set "SCHEMATRON_XSLT_INCLUDE=https://codeberg.org/SchXslt/schxslt/raw/tag/v1.10.1/core/src/main/resources/xslt/2.0/include.xsl"

C:\test>set "SCHEMATRON_XSLT_EXPAND=https://codeberg.org/SchXslt/schxslt/raw/tag/v1.10.1/core/src/main/resources/xslt/2.0/expand.xsl"

C:\test>set "SCHEMATRON_XSLT_COMPILE=https://codeberg.org/SchXslt/schxslt/raw/tag/v1.10.1/core/src/main/resources/xslt/2.0/compile-for-svrl.xsl"
  1. Run the XSpec tests as usual.

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.10.1 to a directory named C:\schxslt-1.10.1-xslt-only\.

C:\test>ant -buildfile "...\build.xml" -lib "...\saxon-he-12.9.jar" -Dtest.type=s -Dxspec.xml="...\my-test.xspec" -Dxspec.schematron.preprocessor.step1="C:\schxslt-1.10.1-xslt-only\schxslt-1.10.1\2.0\include.xsl" -Dxspec.schematron.preprocessor.step2="C:\schxslt-1.10.1-xslt-only\schxslt-1.10.1\2.0\expand.xsl" -Dxspec.schematron.preprocessor.step3="C:\schxslt-1.10.1-xslt-only\schxslt-1.10.1\2.0\compile-for-svrl.xsl"

"Run XSpec Test" transformation scenario in Oxygen

  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.10.1 to a directory named C:\schxslt-1.10.1-xslt-only\.

-Dxspec.schematron.preprocessor.step1="C:\schxslt-1.10.1-xslt-only\schxslt-1.10.1\2.0\include.xsl" -Dxspec.schematron.preprocessor.step2="C:\schxslt-1.10.1-xslt-only\schxslt-1.10.1\2.0\expand.xsl" -Dxspec.schematron.preprocessor.step3="C:\schxslt-1.10.1-xslt-only\schxslt-1.10.1\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.x

Follow the instructions above, using your preferred version of SchXslt.

Using skeleton implementation with XSpec v3.x (not supported)

Using the skeleton implementation with XSpec v3.0 and later 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"