Drafts for Schematron support of EXSLT, XPath2, XSLT2 and STX

by Rick Jelliffe

By default, Schematron uses XPath 1 for setting contexts, testing assertions, and producing dynamic diagnostics. Actually, it is XPath 1 as used and extended in XSLT 1. This has lead many people to think it is just a nicer declarative front-end to XSLT, which indeed it usually has been.

However there have been many requests to allow more powerful languages, and ISO Schematron was designed to allow this. There is an attribute called queryBinding on the top-level schema element, and this lets you declare which query language you are using. The standard even specifies a document called a "Schema Language Binding" and says the information that this must provide. It also reserved several names: "xslt1, xslt2, xpath2, exslt" etc.

So here are the draft text for new annexes I will be submitting to SC34 (and thence to national vote) for augmenting ISO Schematron. EXSLT was a community effort to define some more powerful functions for XSLT1. XPath2 is the updated version of XPath from W3C, very much changed, in particular with a different and large function library; the xpath2 query language binding allows the minimal, untyped, untyped-data profile. XSLT2 is the reworked XSLT1, and the xslt2 query language binding allows the typed data (PSVI) if you want it (Schematron doesn't provide any mechanism for making sure that is what you are working with) and also user-defined functions in the XSLT2 namespace.

Most interestingly, perhaps, is the STX binding. I am supposed to be contacting the STX editor to see about using this query language binding plus the STX specification as an ISO standard (another part of DSDL.) Actually, STX was voted on for this purpose, but without the query language binding some national bodies decided it couldn't be classed as a schema language, but it should be an easy fix, since the hard work has been done and the NBs are onside at last.

The thing about STX is that works in streaming fashion. So you can test documents larger than your virtual memory. STX is much less limited than the subset of XPath that XSD uses.

The draft bindings are here (sorry in boring custom XML not typeset to HTML.) Comments are very welcome, and thanks to the schematron-love-in mail-list members for comments and prods. There are a few other issues on the table for a revised Schematron upgrade, but they all can procede independently of these bindings, if time is not my friend.


Jirka Kosek
2008-02-21 02:24:18
I think that bindings for stx, xpath2 and xslt2 should also add support for stxpath-default-namespace and xpath-default-namespace respectively in order to make writing assertions for namespaced documents easier.

I also think that STX should be little bit shaped before adding this new binding into Schematron. For example cdata nodes could be removed from STX data model, they seem just too odd and they are not present in XPath 2.0 data model also. Maybe it would make sense to separate SXPath & data model from STX and publish it as a separate TR to reference it from updated Schematron standard.

Rick Jelliffe
2008-02-21 02:46:46
Jirka: In Schematron I have maintained a strict policy of making namespaces explicit. The use of defaulting has caused more problems and confusion than almost anything else in XML, and is one reason I have the element rather than using namespace declarations. Data is not markup!

However, it should certainly be looked again.

On the shaping issue, I think it is better to keep exactly the model the query language actually uses: defer all the details to the originating technology. Why make a dialect? Does any STX implementation not make it available? It sounds odd, but when referencing standards tinker with other standards, it sometimes makes things more complicated not less complicated.

An example of this was in Schematron where a rule context could not match text nodes, comments, etc. I don't think there is any need for it, but some people regard those kinds of matches as idiomatic and the customer is always right.