New beta of ISO Schematron available - 2008-08-07
Here is the code for the latest version of the ISO Schematron validator. It includes full support for ISO Schematron including abstract patterns, as well as support for community-requested features on trial for the the updated standard, in particular XSLT2 support. There is a slightly change to the architecture: there are a series of preprocessors (macro processors) which handle includes and abstract patterns (several more are in the pipeline). In a future version for XSLT2, these will be merged into a single file.
- iso_dsdl_include.xsl — Stage 1: substitutes file inclusions. {WARNING: reported non-functional in XSLT1 systems: to be fixed]
- iso_abstract_expand.xsl — Stage 2: substitutes abstract patterns.
- iso_svrl.xsl — Stage 3: metastylesheet which generates a nice XML output format for its reports. Edit this stylesheet to include the XSLT1 or the XSLT2 version of the skeleton depending on your requirements.
- iso_schematron_skeleton_for_saxon.xsl — the basic schematron compiler, optimized for XSLT2.
- iso_schematron_skeleton_for_xslt1.xsl — the basic schematron compiler, optimized for XSLT1.
So the basic processing now looks like this:
xslt -stylesheet iso_dsdl_include.xsl theSchema.sch > theSchema1.sch
xslt -stylesheet iso_abstract_expand.xsl theSchema1.sch > theSchema2.sch
xslt -stylesheet iso_svrl.xsl theSchema2.sch > theSchema.xsl
xslt -stylesheet theSchema.xsl myDocument.xml > myResult.xml
This is slightly more complicated than the previous version, with the extra steps, the benefit is clearer, more modular code, and compatibility with XSLT1 and XSLT2. (And you still can run Schematron with just a command-line interface and COTS XSLT executables.)
Enhancements in this version include features for smarter SVRL output, and parameters for better internationalization, and better integration with toolchains. As well there is better support for XSLT2 and the preprocessors to provide full support of ISO Schematron. (I believe it is a 100% coverage of the ISO standard now, but it also allows various experimental and requested extensions to gain experience for an updated version of the ISO Standard.)
Please send comments and fixes. Other metastylesheets are available elsewhere on this site. If you want to make your own meta-stylesheet or adapt one here, see this documentation.
What is Schematron?
A language for making assertions about the presence or absense of patterns in XML documents
What is Schematron used for?
Business rules validation, data reporting, general validation, quality control, quality assurance, firewallingi, constraint checking
Who uses Schematron?
Schematron is an ISO standard which has uptake in many industries, notably the financial sector (especially insurance), and technical and reference publishing. It is used as the basis of the OASIS UBL Codelist and Value Valuation methodologyi.
Is Schematron a replacement or an adjunct to XSD
While Schematron can express the same constraints that can be expressed in grammar-based schema languages such as XSD (W3C XML Schemas), RELAX NG and DTDs, very often it is used as an adjunct to supplement the intrinsic weak points of grammars if necessary, or to express constraints that may belong to a different conceptual layer such as business rules.
What makes Schematron unique?
Schematron is very simple (only five important elements), very powerful (it can express many kinds of constraints impossible in other schema languages), very diverse (it can be used for business rules, reports as well as the kinds of static constraints usually associated with schemas.)
It places particular emphasis on capturing constraints in human language assertions and generating appropriate human-language diagnostics: this allows a level of user-friendliness not available in other schema languages.
As well, the phase concept allows constraints to be grouped and particular sets of groups checked, rather than all constraints: this can be used for progressive validation (e.g. coarse-grain validation first, validate links next, and so on), or user-role selectable validation, or multi-version schemas.
Schematron schemas can validate co-constraints (if some data is one value, some other data should be constrained to certain values) and even jump across links and between XML documents to check constraints. The diagnostics facility allows multi-lingual schemas.
What implementations are available?
The major implementation is the skeleton implementation at this site. This is an open source implementation which is quite mature, having been in continuous use and development since early 2000. This implementation uses XSLT and can run in any environment that can invoke XSLT transformations. However, while ISO Schematron can (and in some cases has) been implemented directly, for example in languages such as .NET or Java, often the XSLT implementation is well optimized. The SAXON 9 XSLT process is recommonded, however the skeleton has been tested with many other XSLT engines.
How is Schematron used?
The ISO Schematron standard specifies an XML language called SVRL (Schematron Validation Report Language) and this is becoming increasingly popular to represent the output from a validation: by default Schematron implementations do not stop at the first error as grammar-based validators do (they get confused!) so the SVRL report can show errors throughout the entire document. The main implementation is the iso_schematron_skeleton implementation from www.schematron.com uses XSLT, which allows customized outputs to any format including text using metastylesheets and provides several such customizations (the iso_svrl stylesheet being one of them.
Is Schematron tied to XSLT 1.0?
By default, Schematron uses the XPath language as used in XSLT 1.0, and is typically implemented by converting the schema into an XSLT 1.0 script which is run against the document being validated. However, ISO Schematron also allows XSLT 2.0 to be used, and this is becoming an increasingly popular choice because of the extra expressive convenience of XPath 2.0: a different skeleton is available for this.
I see references to Schematron 1.5: what is that?
Schematron 1.n was the original pre-standard version of Schematron from Academia Sinica, Taiwan. Schematron 1.6 was the last version of that line, and the ISO Schematron implementation has taken over. Schematron 1.n and ISO Schematron use different namespaces, but a Schematron 1.n schema can be converted into an ISO Schematron schema with minimal changes. Schematron 1.n is now obsolete and the Schematron 1.n skeleton is no longer maintained; ISO Schematron is the appropriate choice for new projects.
News
July 2008 - new version of the beta implementation. The next release will not be marked beta!
October 2007 - new versions of the beta implementation of ISO Schematron are available with minor changes only. From this version on, there will be two versions of the skeleton implementation: one for the SAXON XSLT2 processor and one for XSLT1 and EXLST processors.
February 2007 - Beta Ant Task for Schematron available. Documentation (PDF) also available. The project is sponsored by Allette Systems and Topologi Pty. Ltd. and will be available under an OSS license. Programmers: Christophe Lauret and Willi Ekasalim.
January 2007 - The beta implementation of ISO Schematron is now available. This XSLT-based implementation is the successor to the Schematron 1.5 stylesheets in wide-spread use (and follows the same "meta-stylesheet" design pattern.) It implements almost all ISO Schematron (only abstract patterns are yet to be implemented) and is the result of collating years of suggested improvements from Schematron users; an implementation status document is available. The implementation is structured as a "skeleton" that allows output functions to be overridden by customized validators; basic API documentation is available.
January 2007 - Accompanying the beta release of ISO Schematron skeleton is several validators that produce customised output. Schematron Terminator is a validator that halts with an error code when the first error is detected. Schematron SVRL is a validator that generates Schematron Validator Report Language XML documents, which are specified by the ISO Schematron standard. Notes on the page detail a technique for using a Schematron schema to test SVRL documents, and on how the new flag attributes can be used.
January 2007 - ISO SVRL (Schematron Validation Report Language) implementation now available from this site. SVRL is an XML language to present the results of validating with a Schematron schema. It can be used for testing implementations, benchmarking, and for collecting validation data to be onsent to other formatting or reporting stages. SVRL is Annex D of ISO Schematron.
November 2006 - ISO Schematron specification now available free from ISO under Publicly Available Specification program.
July 2006 - Article on IBM DeveloperWorks: Apply Schematron constraints to XForms documents automatically
July 2006 - Quote from Microsoft's Program Manager for XML Standards Mike Champion I encourage people who hit the wall with XSD in the Microsoft environment to try out Schematron constraints, use the reference XSLT implementation, and see if that works for them.
June 2006 - US military-related thinktank MITRE's Open Vulnerability Assessment Language (OVAL 5.1) uses Schematron.
May 2006 - Schematron is now published as an ISO Standard
March 2006 - Schematron used intensively in ACORD insurance application for the London Market: London Market Implementation of ACORD DRI Messages and Data See also the Market Reform Group's page Schematron - the benefits and the Lloyd's press release Schematron presses the right buttons
February 2006 - Users and developers mail-list schematron-love-in revived thanks to Betty Harvey ECC and Washington XML Users Group. Users stirring in preparation for the advent of ISO Schematron.
February 2006 - Announcement of SchematronWiki, a wiki (informal collababorative web-bsed set of linked information pages) for Schematron.
February 2006 - Notice received from ISO secretariat that final editorial changes have been accepted, national votes in order. Expect final acceptance and publication in April.
August 2005 - Final text and reference implementation of ISO Schematron in preparation (delay due to illness of editor)
July 2005 - ISO Schematron accepted for ISO Standard after final internalational vote. ISO SC34 proposes that the ISO Schematron specification should be freely available (being based on a previously existing technology.)
February 2004 - Misc. editorial improvements to Committee Draft spec available.
February 2004 - Schematron 1.5 validation available in new Topologi Judge validation utility and Topologi Markup Editor 2.4 editor
January 2004 - Schematron 1.5 validation support added to Oxygen XML editor
November 2004 - final Committee Draft specs for ISO Schematron now available in PDF, RTF and HTML
October 2004 - SCHEMATRON.COM goes live!
September 2004 - Committee Draft of ISO Schematron available.
August 2004 - Schematron link to this site added to official Sun documentation for Java API for XML validation.
SCHEMATRON.COM is a site to encourage and support implementations and users of the forthcoming standard ISO Schematron.
If you have news, please email ricko(at)topologi.com
Click here for old news.
