The base-uri function in the schema for checking xml probatron + saxon

We used probatron and saxon to test the test xml using this sch file in our Java application. Recently, a new rule has been added to the sch file , for example

<let name="foo" value="base-uri()">

and some rules use this value, but $ foo contains an empty string, and the rules fail. Where do I need to set this value? I added xml: base tags to the test xml, as stated in https://www.w3.org/TR/xmlbase/ , but this did not work. Should I install sth in the java side?

EDIT (solution found) We used probatron4j to process java-based diagrams:

Java source part:

javax.xml.transform.TransformerFactory t = org.probatron.Utils.getTransformerFactory();
// create xml readers, perfor template processing, apply xslt
// as stated in the probatron4j examples
// ...

t.transform(getCandidateSource(), new StreamResult(baos));

Our fix includes:

Source source = new StreamSource(new FileInputStream(..

// or

Source source = new StreamSource(canditateURL.openStream()..

// depending on whether input source is file or url based

// below is the fix, we set path of file or exteral form of the url

source.setSystemId(pathOrUrl);

: , systemid, base-uri() val .

+6

All Articles