We used probatron4j for java based schematron handling:
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);
Final result: The value we set as systemid is set into the return value of the base-uri()
function val in the schema.
This answer was posted ahttps://stackoverflow.com/questions/45692818/base-uri-function-in-schematron-for-validating-xml-probatron-saxon by the OP benchpresser under CC BY-SA 3.0.