An EXPath module for schematron?

Skip to first unread message

Andy Bunce

Jan 7, 2015, 6:00:30 AM1/7/15

I wonder if there would be value in defining a EXPath module for schematron validation. 
Norman Walsh's ML-Schematron ,which has minor Marklogic dependencies, could serve as a model for the XQuery implementation.


Joe Wicentowski

Jan 7, 2015, 9:06:56 AM1/7/15
Hi Andy,

Sounds like a good idea, but I have one question.  It looks like Norm's library is a wrapper for the Schematron XSLT libraries.  How are you planning to deal with the need for an XSLT processor?


Sent from my iPhone
You received this message because you are subscribed to the Google Groups "EXPath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

Adam Retter

Jan 7, 2015, 10:17:09 AM1/7/15
I am not particularly interested in Schematron, but I am interested in
abstraction. The 3 function signatures in Norm's library of interest
appear to be:

1) declare function sch:compile-schema($schema as node(), $params as
map:map?) as document-node(element(xsl:stylesheet))

2) declare function sch:validate-document($document, $schema)

3) declare function sch:validate-document($document as node(), $schema
as node(), $params as map:map?) as

(1) at the moment is of no use by itself, and is only a utility of
(3), and (2) is a shorted convenience function for (3).

I don't think you need to worry about XSLT as it is an implementation
concern, instead it is better to focus of defining generic and
re-useable function signatures. The only implementation concern in the
signatures above is the return type of (1) which you could abstract
away by using higher-order-functions.

Looking at the above, and thinking about it, there are two stages to
any validation:

1) Compiling the validation grammar
2) Validating a document with the validation grammar.

A question here is, should (1) and (2) be separate public functions so
that the user can choose how to re-use/store compiled grammars, with
the result of (1) feeding into (2),, or should (1) and (2) be a single
validate function, and it is up to the implementation to automatically
optimise for the reuse of compiled grammars?

Another question is scope. Is this just about Schematron, or do you
want a general XML Validation module, I am thinking Schematron,
RelaxNG, XML Schema and DTD?
Adam Retter

eXist Developer
{ United Kingdom }

Claudius Teodorescu

Jan 7, 2015, 10:58:26 AM1/7/15

An XML Validation module is a very nice idea!

There can also be functions for conversions from a schema format to another, exporting grammars to visual formats (HTML, SVG), etc.


Claudius Teodorescu

Jan 7, 2015, 11:01:01 AM1/7/15
Grammar checking, too ...
Reply all
Reply to author
0 new messages