Schematron 1.5

Copyright (C) 2001 Rick Jelliffe. Freely and openly available under zlib/libpng license.

This schema is open: it only considers elements in the Schematron namespce. Elements and attributes from other namespaces can be used freely. This schema does not assume that the Schematron schema is the top-level element.

This schema uses conservative rules (e.g. no use of key()) to work with incomplete XSLT-based implementations.

For creating new documents.

For fast validation of draft documents.

For final validation and tracking some tricky problems.

These rule establish the smallest possible Schematron document. These rules may be handy for beginners with starting documents.

A Schematron schema should have a schema element. There should only be one schema per document. A Schematron schema should have pattern elements inside the schema element A Schematron schema should have rule elements inside the pattern elements. Rule elements should have a context attribute. A Schematron schema should have assert or report elements inside the rule elements. Assert and report elements should have a test attribute.

Rules defining occurrence rules for Schematron elements and their required attributes. Note that for attributes, it is not that the attribute is being tested for existance, but whether it has a value.

Some elements require certain children or attributes. Other elements require certain parents. Schematron can represent both these kinds of coupling.

The element should only appear inside the Schematron element rule. A element should contain a natural language sentence. The element must have a value for the attribute test. This should be an XSLT expression. The element cannot have a context attribute: that should go on the rule element. The element should contain only the elements title, ns, phrase, p, pattern, diagnostics or phase from the Schematron namespace. A schema element should contain at least one pattern element. A Schematron schema should not appear as a child of another Schematron schema. The value of the defaultPhase attribute must match the id of a phase element. The element should only appear inside the Schematron element schema. The element should only appear as the first element from the Schematron namespace in the schema element. The element should only appear inside the Schematron element schema. The element must have a value for the attribute prefix. The element must have a value for the attribute uri. The element must come before any other Schematron elements, except the title The element should be empty. The element should only appear inside the Schematron element schema. The elements must come before any other Schematron elements, except the title, ns and p elements The element should only appear inside the Schematron element phase. The element must have a value for the attribute pattern. The element should only appear inside the Schematron element schema. The element should contain only rule and p elements from the Schematron namespace. The element should contain at least one rule element. The element must have a value for the attribute name. A Schematron schema cannot have more than one title element. The element should only appear inside the Schematron element pattern. The element should contain only the elements assert, report, key or extends from the Schematron namespace. The element should contain at least one assert, report or extends elements. The element cannot have a test attribute: that should go on a report or assert element. An abstract rule cannot have a context attribute. An rule should have an id attribute. The element should only appear inside the Schematron element pattern. The element should contain only the elements assert, report, key or extends from the Schematron namespace. The element should contain at least one assert, report or extends elements. The element cannot have a test attribute: that should go on a report or assert element. A rule should have a context attribute. This should be an XSLT pattern for selecting nodes to make assertions and reports about. (Abstract rules do not require a context attribute.) In a rule, the abstract attribute is optional, and can have values 'true' or 'false' The element should only appear as a child of the schema element The element should be the last element in the schema. The element should only appear in the diagnostics section. The element must have a value for the attribute id. The element should only appear in a rule. The element must have a value for the attribute name. The element must have a value for the attribute path. This should be an XPath expression. The element should be empty. The element should only appear in a rule. The element must have a value for the attribute rule. The element should be empty. The element should have an attribute rule which gives the id of an abstract rule. The element should only appear inside an element from the Schematron namespace. It is equivalent to the HTML element of the same name. The element should only appear inside a Schematron elements p (paragraph) or diagnostic. The element should be empty. The element should only appear inside a Schematron elements p (paragraph) or diagnostic. It is equivalent to the HTML element of the same name. The element should only appear inside a Schematron elements p (paragraph) or diagnostic. The attribute value of the element must be lowercase "rtl" or "ltr". It is equivalent to the HTML element of the same name. The element should only appear inside a Schematron elements p (paragraph) or diagnostic. It is equivalent to the HTML element of the same name. The element should only appear inside the Schematron element diagnostic. The element must have a value for the attribute select. The value should be an XPath expression. The element should be empty. The element is not an element from the Schematron 1.5 namespace

These rules specify which elements each attribute can belong to, and what they mean.

The boolean attribute abstract can only appear on the element rule. An abstract rule can be used to extend other rules. The attribute class can only appear on the elements span and p. It gives a name that can be used by CSS stylesheets. The attribute context can only appear on the element rule. It is an XPath pattern. The attribute defaultPhase can only appear on the element schema. It is the id of the phase that will initially be active. The attribute diagnostics can only appear on the elements assert and report. It is the id of some relevent diagnostic or hint. The attribute fpi can only appear on the elements schema and phase. It is an ISO Formal Public Identifier. The attribute icon can only appear on the elements schema, assert , diagnostic, key, p, pattern, phase and report. It is the URL of a small image. The attribute id can only appear on the elements schema, assert, p, pattern, phase, report, rule and diagnostic. It is a name, it should not start with a number or symbol. The attribute name can only appear on the elements pattern and key. The attribute ns can only appear on the schema element. It is the namespace to which the names in the role attributes belong. The attribute path can only appear on the element key. It is an XPath path. The attribute pattern can only appear on the element active. It gives the id of a pattern that should be activated in that phase. The attribute prefix can only appear on the element ns. The attribute role can only appear on the element assert, report or rule. It is a simple name, not a phrase. The attribute rule can only appear on the element extends. It is the id of an abstract rule declared elsewhere in the schema. The attribute see can only appear on the element pattern. It is the URL of some documentation for the schema. The attribute select can only appear on the element value-of, with the same meaning as in XSLT. It is an XSLT pattern. The attribute schemaVersion can only appear on the element schema. It gives the version of the schema. The attribute subject can only appear on the elements assert and report. It is an XSLT pattern. The attribute test can only appear on the elements assert and report. It is an XPath expression with the XSLT additional functions. The attribute uri can only appear on the element ns. It is a URI. The attribute value can only appear on the element dir. It sets the directionality of text: 'rtl' is right-to-left and 'ltr' is left-to-right. The attribute version can only appear on the element schema. It gives the version of Schematron required as major number "." minor number. Every attribute on a Schematron element must have a value if it is specified.
Check this is not a spelling error. The recognized element names are schema, title, ns, pattern, rule, key, assert, report, diagnostics, diagnostic, name, value-of, emph and dir. The element appeared inside a .