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
document-node(element(svrl:schematron-output))?
(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 }
ad...@exist-db.org
irc://
irc.freenode.net/existdb