As promised, Schematron rules are now the second step of the validation process. Fortunately, it is trivial to accomplish - just use "xsltproc" to process your source with a new (provided) stylesheet.
Why? RELAX-NG is a grammar and is very good at expressing parent-child relationships. But when more elaborate context is involved, it can get very complicated. And that is where Schematron excels. So the two tools are complementary.
Schematron is a feather duster to reach the corners that other schema languages cannot reach. -Rick Jelliffe
Quickstart:
http://mathbook.pugetsound.edu/doc/author-guide/html/pretext-schematron.htmlNew overview:
http://mathbook.pugetsound.edu/doc/author-guide/html/schematron.htmlMinor adjustments to:
http://mathbook.pugetsound.edu/doc/author-guide/html/schema.html
The schema should now be whole lot cleaner, since ten redundant patterns necessary for WeBWorK problems have been replaced with two rules catching exceptions. Some other exceptions could conceivably migrate from the processing phase to the validating phase.
Please discuss on -support or -dev, as appropriate.
Rob