[darcusblog:hacks] RELAX NG Does Schematron?

by M. David Peterson

A good year and half back, I came to the realization that while Bruce (D'Arcus) claims to be a scholar, he's truly a hacker at heart.

Proof:

darcusblog � Blog Archive � RELAX NG, XSD, Schematron

However, you end up with a much looser schema, so now what? It's hardly much use to be creating instances against such a loose schema, where they may be invalid against the normative spec and schema.

Answer: create some separate Schematron rules to model the constraints that XSD cannot. If you want to write it within your RNG customization schema (which can then be extracted using Trang XSLT), then just do stuff like:

    s:rule [
context = "/cs:style[@class='author-date']"
s:assert [
test = "cs:bibliography/cs:sort/@algorithm='author-date'""Must use author-date sorting for the author-date class."
]
s:assert [
test = "name(cs:citation/cs:layout/cs:item/*[1]) = 'author'""The citation item layout must include an author element first."
]
]


Finally, write a little shell script to run both validations.


Nice!

Please visit the above linked post for more info.

Thanks Bruce! :)