Saturday, March 24, 2007

Schematron

Schematron is one of those bits of technology, like the indoor grill, that people may not realize they needed. Also like the indoor grill, there may have been times they recognized the deficiency of the alternatives and wished for some unspecified better way. Schematron is an XML schema language whose basic concept is a set of XPath-expressed rules or patterns for validating a document. Each rule matches some element, then tests a set of related assertions in the context of that element. It appears to be less of a full replacement for other schema languages than a complement to them, because existing schema languages essentially say "accept documents that look like this" whereas in Schematron each individual fact about valid document structure is a separate part. If anyone needed motivation to better learn XPath (which I like to think of as "advanced regular expressions for XML"), Schematron is it.

Schematron has gone through standardization, for those concerned with interoperability. Note that ISO Schematron is separate from the other, pre-standard versions out there. There is a beta release of ISO Schematron that is a reference-implementation-but-not-officially. This specific implementation takes the remarkable approach of transforming a Schematron document through XSLT into an output XSLT document. Then the output XSLT performs Schematron validation by transforming any XML document into validation output. XSLT produces XSLT. Another intriguing part of the implementation is that it is a "skeleton" with templates that are meant to be overwritten for producing output. So the same skeleton XSLT has been included in an XSLT that outputs plain text, an XSLT that stops on the first valiation error, and an XSLT that outputs validation results in XML (naturally), the SVRL language. I should mention there are other, platform-of-choice, implementations of Schematron, too.

It goes without saying, but Schematron may also be the best name for XML technology, ever.

Unrelated Babble: I'm sure others have said this, but have you noticed how Lost and Heroes have a yin-yang thing going on? Heroes is about incredible people in ordinary surroundings. Lost is about (to some degree) ordinary people in an incredible situation/setting. For a while, Heroes had the comic-booky downfall of feeling plot-driven and hokey. For a while (pre-hiatus), Lost had the melodramatic downfall of running-in-place while characters develop their relationships but effectively not much else. But quite recently, Heroes has probed more into its characters' motivations (did you see the episode with the story of Claire's adoption?) and Lost has had its characters accomplishing more. To do well, these shows need balance up (out?) the yin-yang.

No comments:

Post a Comment