A Schematron schema uses rule/@context
to select nodes in a document to apply assertions (represented by assert
and report
) to. So in contrast to the rule-based processing of XSLT (where rule/@context
typically translates to xsl:template/@match
), with XQuery we are selecting nodes we are interested in, rather than them being supplied to us by default. So the decision here was to interpret any expression given in rule/@context
as being evaluated in the context of the instance document root.
The obvious but important implication for schema authors who are used to targeting XSLT implementations is that e.g. <rule context="*">
will only match the root element in XQS, as opposed to any element in the document (and therefore the path in this case should become //*
instead).