Attribute 'document' is not allowed to appear in element 'svrl:active-pattern'
pigelvy opened this issue · 3 comments
Using SchematronResourceSCH (r7.0.1), the SVRL mashalling fails. It seems that the active-pattern
contains the attribute document
instead of documents
.
Here's a simple JUnit test showing the problem.
@Test
void simple_test() throws Exception {
String xml = "<xml id='1'/>";
String sch = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<schema xmlns=\"http://purl.oclc.org/dsdl/schematron\" queryBinding=\"xslt2\">\n" +
" <pattern>\n" +
" <rule context=\"xml\"><assert test=\"exists(@id)\">No id</assert></rule>\n" +
" </pattern>\n" +
"</schema>\n";
final SchematronResourceSCH schResource = SchematronResourceSCH.fromString(sch, UTF_8);
final SchematronOutputType schematronOutputType = schResource.applySchematronValidationToSVRL(new StringStreamSource(xml));
final SVRLMarshaller svrlMarshaller = new SVRLMarshaller();
svrlMarshaller.getAsString(schematronOutputType); // This throws an exception
}
I cannot reproduce this Exception on my side.
Looking at my (self-built) XSD, I can see this comment:
<!-- [ph] Schematron 2016 adds this in favor of "document" -->
<xs:attribute name="documents" type="xs:string"/>
...
<xs:attribute name="document" type="xs:string"/>
So this is kind of Schematron-specification dependent.
The RNC of the 2006 specification contains this snippet:
The RNC of the 2016 specification contains the "documents" attribute:
Edit: for Schematron 2020 is identical to 2016 for this field
And ISO Schematron emits the document
attribute:
And finally SchXslt 1.9.5 does it according to Schematron 2016:
It is all very messy....
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Bascially by chosing an implementation you can decide what attribute you will get. Hope this works.
Or shall we modify the ISO Schematron XSLT to produce documents
instead?