Summary

Schematron encourages the use of natural language descriptions targeted to human readers. This way validation can be more than just a binary distinction (document valid/invalid) but also support authors of in-progress documents with quick feedback on erroneous or unwanted document structure and content.

To this effect an assertion test is associated with zero or more natural-language statements written in a lightweight templating language. The specification distinguishes between a primary statement given in the element content of an assertion element, and secondary statements or diagnostic given in the element content of a sch:diagnostic element and referenced in a diagnostics attribute of an assertion element.

The 2016 revision added a mechanism for structured data targeted at machine rather than human consumption. Designed in the same fashion as diagnostics, an assertion may reference zero or more sch:property elements in a properties attribute. Each property element contains a template for structured data.

The templates for natural-language statements and structured data are instantiated when the respective assertion fails. The templating language contains both, elements for text formatting (sch:emph, sch:span, sch:dir) and elements that calculate values from the instance document (sch:value-of, sch:name; xsl:copy-of in sch:property for the query languages XSLT 2.0 and 3.0).