phax/ph-schematron

Role is not returned when a rule is fired

Closed this issue · 5 comments

I have created a rule that is fired, but when I get back the FiredRule or the SuccessfulReport, the role value is null.

My rule looks like this:

metadata/description element is missing and is a required field.

I tried putting it in the rule and also in the report, but neither work.

phax commented

I had a TODO in the code for "role" handling.
I tried to fix this in the latest SNAPSHOT - can you please check this? Should be on Maven Snapshot repository quiet soon! Thx!

Hmm... I built the latest and changed my pom file to reference 5.0.0-SNAPSHOT. When I get back a SuccessfulReport object, the role is still null. Can you send me a rule that has a role that works?

phax commented

The problem is - I don't have an example. Can you please send me yours - I of course handle it confidentially.

phax commented

See the example file in the above commit.
The output looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<schematron-output xmlns="http://purl.oclc.org/dsdl/svrl" title="" schemaVersion="">
  <active-pattern id="sampleValidation" name="sampleValidation" document="" />
  <fired-rule context="CCC" role="abc" />
  <fired-rule context="CCC" role="abc" />
  <failed-assert location="/simple[1]/CCC[2]" test="A and B">
    <text>A and B must be present</text>
  </failed-assert>
  <fired-rule context="CCC" role="abc" />
  <failed-assert location="/simple[1]/CCC[3]" test="A and B">
    <text>A and B must be present</text>
  </failed-assert>
</schematron-output>

it is located in the Schematron like this:

    <sch:rule context="CCC" role="abc">
      <sch:assert test="A and B">A and B must be present</sch:assert>
    </sch:rule>

When using the "pure" version for parsing, you need to wait for v5.0.0 for it to work. When using the regular Schematron/XSLT approach, this should also work for v4.x. hth