A Schematron schema that checks the XPath expressions in your Schematron
c7136568 — David Maus 5 months ago
72e9e046 — David Maus 5 months ago
Remove Balisage 2023 slides
1c9aa9ba — David Maus 6 months ago



You can also use your local clone with git send-email.

#The Schematron Schematron

The main repository of Schematron Schematron is located at sourcehut.

There is a push-only copy at GitHub.


Schematron Schematron is a Schematron schema that checks XPath expressions in your Schematron. It uses parsers for XPath 2.0 or XPath 3.1 depending on the @‍queryBinding attribute to check the syntax of XPath expressions.

It checks the following attributes:

  • sch:assert/@test
  • sch:let/@value
  • sch:path/@name
  • sch:pattern/@documents
  • sch:report/@test
  • sch:rule/@context
  • sch:value-of/@name
  • xsl:copy-of/@select

Starting with version 1.1 it also performs a static analysis of the expression and warns about the following potential problems:

  • QNames with prefixes that are not declared by a sch:ns element
  • functions in the null namespace that are not defined by the XPath function and operator specifications
  • variables that are not declared by a sch:let element

The idea of Schematron Schematron was conceived during the TEI 2022 Conference in a discussion with Martin Holmes.

Note Schematron Schematron relies on a Schematron processor that supports the xsl:include element. This is non-conformant behaviour but supported by both the Skeleton implementation and SchXslt.

Note Contrary to the specification, Schematron Schematron uses xslt2 as the default value when no @‍queryBinding is defined. You can override the default value by passing the parameter queryBinding to the validation stylesheet.


Schematron Schematron is copyright © by David Maus <dmaus@dmaus.name> and released under the terms of the MIT license.

The XPath 2.0 and XPath 3.1 parsers are generated by the REx Parser Generator by Gunther Rademacher and contain fragments of REx source code supplied under the Apache 2.0 license.

The function and operator libraries where extract from the respective documents, the XPath 2.0 specification, the XPath 3.1 function catalog, the XSLT 3.0 specification, and the XSLT 2.0 specification.


David Maus <dmaus@dmaus.name>


Kosek, Jirka. 2017. “Improving Validation of Structured Text.” In XML London 2017 Conference Proceedings, 56–67. London, United Kingdom: XML London. https://doi.org/10.14337/XMLLondon17.Kosek01.

Maus, David. 2023. “Schematron Schematron.” Presentation presented at Balisage: The Markup Conference, online, August 2.