A schema
contains a title
and a pattern
Each pattern
contains rules
Each rule
contains assert
and report
elements and has a context
attribute
Each assert
and report
element
has a test
attribute containing an XPath expression
whihc returns a boolean.
The contents of each assert
element is printed if the assertion test fails
The contents of each report
element is printed if the report test
succeeds
<?xml version="1.0"?> <schema xmlns="http://www.ascc.net/xml/schematron"> <title>A Schematron Schema for Songs</title> <pattern> <rule context="SONG"> <assert test="TITLE"> A SONG must contain an initial TITLE element. </assert> <assert test="TITLE[position()=1]"> The TITLE element must be the initial element of the SONG element. </assert> <assert test="COMPOSER"> A SONG must contain at least COMPOSER element. </assert> <assert test="ARTIST"> A SONG must contain at least one ARTIST element. </assert> </rule> </pattern> </schema>