Schematron for XML and XHTML prolog validation

With DTD, XML Schema or other grammar-based schema languages we can not validate the prolog that is what is before the top-element of an XML document. We can use Schematron to validate XML declaration and DTD and to validate comments, processing instructions and whitespace before the top-element.

Validating implicit XHTML hierarchy with Schematron

Most XHTML documents benefit from an implicit hierarchical structure made with h1-h6 heading elements. The hierarchy is making further processing easier, and it adds to usability, accessibility and to Search Engine Optimization. We can use Schematron to validate an implicit hierarchy.

Schematron for checksum validation

ISO Schematron, using XPath 2.0 for testing, is the natural choice for schema validation of numbers with checksum digits in XML documents. In this tutorial we look at MOD 10 calculations for UPC, EAN, ISBN and credit card numbers. First we make the XPath expressions in XSLT and at the end we transfer them to Schematron.

Updated 2008-11-10