Search This Blog

Thursday, September 27, 2007

Converting XML Schemas to Schematron

Recently Topologi have been working on an actual implementation for a
client [for converting XML Schemas to Schematron]: a series of XSLT 2
scripts that we want to release as open source in a few months time.
Why would you want to convert XSD to Schematron? The prime reason is to
get better diagnostics: grammar-based diagnostics basically don't work,
the last two decades of SGML/XML DTD/XSD experiences makes plain. People
find them difficult to interpret and they give the response in terms
of the grammar not the information domain. Basically, we have a two-stage
architecture: the first stage (3 XSLTs) takes all the XSD schema files
and does a big series of macro processes on them, to make a single
document that contains all the top-level schemas for each namespace,
with all references resolved by substitution (except for simple types
which we keep). This single big file gets rid off almost all the
complications of XSD, which in terms makes it much simpler to then
generate the Schematron assertions. We have so far made the preprocessor,
implemented simple type checking (including derivation by restriction)
and the basic exception content models (empty, ALL, mixed content),
with content models under way at the moment. I think the pre-processor
stage might be useful for other projects involving XML Schemas. More Information

No comments: