FAQ
From Schematron
Schematron Implementer's FAQ
See also Unresolved issues
Q1. Is Schematron an ISO Standard now?
A. Yes.
Q2. Is the ISO standard for Schematron available for free on the WWW?
A. Yes, it is now available at ISO The website SCHEMATRON.COM may have extra information.
Q3. Is there a forum for Schematron implementers and developers?
A. Yes, the resurrected Schematron-Love-In maillist run from the same site as this Wiki.
Q4. What does a implementer do when there seems to be an inconsistency in the standard?
A. First, there is a rule of interpretations of standards that where there are several possible but inconsistant interpretations, and one consistent interpretation, use the consistant one. For example, in the Default Query Language Binding it says to us "the extended version of XPath specified in XSLT" but that "The assertion test is interpreted according to Production 14 of XPath": so is document() allowed--the text seems to be contradictory (are assertions XPath or XSLT?) but there is a non-contradictory interpretation (that XPath provides the syntax but not the complete function list, while XSLT provides the function list), so that is the one to assume.
Second, there is a community of developers and implementations. Consult and follow them,
Third, there is this page, which can be used to add extra information as needed. The ISO Schematron standard errs on the side of minimalism and does not attempt to enumerate pathological cases. Contrast it with the XSD specs.
Q5. What should an implementation do if there are query constructs that will give different results in different implementations?
A. Apparently there are some constructs such as document("") which will give different results in different implementations. These are not explicitly banned or enumerated in ISO Schematron. In one sense, it would be perverse for anyone to make a schema using such a construct, and they may deserve any interoperability troubles they get, and implementers are not bound to cope with the acts of madmen; on the other hand, implementers may find it more satisfactory to discover, publicize and cope with these special cases, so that users who innocently use an inappropriate construct are alerted.
So here is a list of strings that, if they appear in XPaths in Schematron, may at implementator discretion generate some kind of error:
document("")
Rick Jelliffe encourages implementers and developers to add strings and questions to this FAQ as they are discovered.
Q6. Is there a reference implementation of ISO Schematron?
A. No. ISO rules do not allow reference implementations, because of the danger of contradiction with the text: there is a drafting rule that a requirement can only be stated normatively once. However, recently ISO JTC1 SC34 WG1 has been drafting other parts of the DSDL standard including non-normative implementation code. Unofficially, the ASCC skeleton code acts as a reference implementation, in the sense of showing the general semantics only.
Q7. Why is the include mechanism in Schematron so primitive?
A. The include mechanism in Schematron is utterly minimal and does not allow fragment identifiers like XPointers. (There is nothing stopping server-side fragmentation however.) Use XLink, ISO DSRL, ISO NSVL and XML Pipelines for complex inclusions.
Q8. Why doesn't Schematron use namespace declarations in the standard W3C way?
A. Actually, there is no standard W3C way. The Namespaces in XML spec only relates to how prefixes in element and attribute namesa are interpreted, not qnames in attribute values, and Schematron complies with those rules. Rick took this issue all the way to the W3C TAG (Technical Advisory Group) to make sure it was OK. People think that the way that XSLT does things is the only possible way, however XSD also uses elements to affect qname interpretation (e.g. @qualifiedFormDefault or whatever it is called.) Some other specifications have adopted Schematron's method.
Q9. Is the use of document() with relative paths reliable?
A. There are comments that the use of document() with a relative path is unreliable at the moment for XSLT-transformation-based implementations that store the compiled schema in a temporary directory. Eric van der Vlist recommends the use of the second parameter in the document() functions as best practise for schema writers; Rick Jellife also suggests using absolute URIs. A possible heuristic for this might be as simple as an implementation testing the string inside the document() functions parenthesis (naively obtained) for the presence of either a ":" (suggesting an absolute URI is being used) or a "," (suggesting a second parameter is supplied) and generating a warning otherwise.
Q10. I get an IDREF invalidity error when using included abstract patterns. What's wrong?
A. The standard schema is wrong. Or, at least, it is right against the *resolved* schema, after the inclusion has been made. Implementers providing the RELAX NG schema may care to check that the IDREF constraint is replaced by NMTOKEN for attribute @is-a, and that the constraint is checked in the Schematron schema instead. This will probably be corrected in a future version of the standard.