RelaxNG validation test case

I have successfully run the RelaxNG validation test case catalog-010 - thanks Charles.

I made a couple of changes:

(1) In the stylesheet, changed rng:schema-report('schema-for-xslt30.rnc') to rng:schema-report(resolve-uri('schema-for-xslt30.rnc', static-base-uri())) to make the location independent of current working directory. 

I think it would be better if the rng:schema-report function itself resolved a relative URI against the static base. Note also, the implementation of the function creates an InputSource containing the relative URI as a systemId, which although common practice, is against the contract for InputSource.setSystemId(): "If the system identifier is a URL, it must be fully resolved (it may not be a relative URL)."

(Charles: to resolve href against static base in your extension function, override supplyStaticContext() in your implementation of ExtensionFunctionCall, and capture the value of staticContext.getStaticBaseUri()).

(2) Added dependencies to the test case:

   <dependencies>
       <spec value="XSLT30+"/>
       <extension-function value="Q{http://relaxng.org/ns/structure/1.0}schema-report#1"/>
       <feature value="higher_order_functions"/>
    </dependencies>

And added <extension-function> to the catalog schema. The idea is that the test driver can avoid running the test if the extension function isn't supported. I figured this mechanism was general enough to be useful for (e.g.) EXPath tests using our test framework, and indeed for users' and vendors' internal tests written to the same interface.

(3) Added match="/" to the two entry templates. Our test driver assumes that if there is a source document with role=".", and no <initial-template> element, then the stylesheet is invoked using apply-templates. A lot of tests would break if we changed that. If we want to refactor the entry conditions for stylesheets, this will involve quite a bit of work.

Michael Kay
Saxonica

Received on Tuesday, 27 September 2016 13:52:30 UTC