Skip to main content
\( \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} \)

Section 5.2 Schematron Rules

The RELAX-NG schema is very good at specifying “parent-child” relationships, in other words, which elements can nest directly under/within other elements. But we have situations where the possible elements depend on grandparents, great-grandparents, or older ancestors. An example is the <var> element, which is only useful if it is contained somewhere within a <webwork> element. You can describe these situations with RELAX-NG, but it becomes cumbersome and redundant. So our stategy is to allow some prohibited situations in the RELAX-NG schema, and use Schematron rules to identify the prohibited situations. Continuing our WeBWorK example, the RELAX-NG schema makes it appear that <var> can be used many places, but a Schematron rule will provide a helpful message indicating you have used it outside the context of a WeBWorK problem.

Schematron is a feather duster to reach the corners that other schema languages cannot reach.

―Rick Jelliffe