Collections of tests
-
schema are collections of
patterns
A schema is a group of patterns. Unlike RELAX NG patterns, Schematron patterns are just named
clusters of rules.
-
Rules contain assertions and reports
assert means notify on test failure, while
report means notify on success.
-
An example
<rule context="email">
<p>Found an email address...</p>
<assert test="contains(.,'@')">Error: no @ in email address</assert>
<assert test="contains(.,'.')">Error: no . in email address</assert>
<report test="length(.)>30">Warning: email address is unusually long</report>
</rule>
-
Schematron uses XPath's nearly infinite reach
XSLT developers have long since mastered the art of contorting XPath into a general purpose
tool for reaching anywhere in a document from anywhere in a document.
-
Comparisons and calculations
XPath lets developers perform mathematical and string-handling operations that are beyond
the reach of most schema languages. Because Schematron is itself XML, it's also possible to generate
Schematron schemas which rely on more complex sources of information.
-
Copes well with program anomalies
If you know the conditions that trigger a bug in a particular program, you can generally write
a Schematron that identifies those conditions in incoming data.
Previous Page <
TOC
> Next Page