So I'm trying to use a schematron to validate an XML. from the XdmNode I'm getting the following warning
!--WARNING: Rule for context "test:responseTest" shadowed by preceding rule-->
this is when looping through all the XdmNodes from the rootnode
for (XdmNode node : rootnode.children().iterator().next().children()) {
if(node.getNodeKind() == XdmNodeKind.COMMENT) {
continue;
}
}
is this an issue with the schematron or how do I fix this?
I see this warning in a Schxslt generated SVRL report if I duplicate a rule with the same
contextinside of apatterne.g.when applied on
generates a report like
which is basically an attempt by Schxslt to point out that the second
assertis not taken into account as only the first match is used; depending on your intentions and schema and instance documents this might happen but it could also be a coding error in the Schematron schema so I think the warning is helpful in that case.Schxslt has a parameter
<xsl:param name="schxslt.svrl.compact" as="xs:boolean" select="false()"/>that by default is false, if you set it totrue()then I think warning and suppressed-rule output will not occur.As for the question in a comment as to which line a suppressed-rule refers to, it appears that the Schematron SVRL or Schxslt implementation doesn't assume you want e.g. a
locationattribute on those elements but it is easy to change or override two templates insvrl.xslof Schxslt to do e.g.then you get output like e.g.
<svrl:fired-rule location="/Q{}root[1]" context="*"/>and<svrl:suppressed-rule location="/Q{}root[1]/Q{}item[1]" context="*"/>.