Schematron / schema-2016

Unofficial copy of schema(s) for Schematron 2016.
Other
4 stars 2 forks source link

svrl:fired-rule should have a @‍document attribute #7

Closed dmj closed 4 years ago

dmj commented 5 years ago

Schematron 2016 added the optional @‍documents attribute to indicate subordinate documents that should act as context for the pattern's rule. But there is no attribute in SVRL to indicate the document a rule fired in.

One might put it in the @‍location of svrl:failed-assert/svrl:successful-report (i.e. location="document('...')/...") but this seems wrong to me. A report consuming application would have to parse out this information.

I think it would be best if SVRL provided a way to explicitely report the document.

  fired-rule =
       element fired-rule {
           attribute id { xsd:NMTOKEN }?,
           attribute name { text }?,
           attribute context { text },
           attribute role { xsd:NMTOKEN }?,
           attribute flag { xsd:NMTOKEN }?,
+          attribute document { xsd:anyURI }?,
           empty
       }
dmj commented 5 years ago

Funny. I see that the skeleton implementation creates a @‍document property on svrl:active-pattern. This would imply that a processor should report a pattern to be active for every (subordinate) document. Is this the intended behaviour?

tgraham-antenna commented 5 years ago

I was expecting that the intention would have been lost in the mists of time, but there is this entry in the initial comment:

2009-02-19
    * RJ add experimental non-standard attribute active-pattern/@document which says which
    document is being validated from that point to the next similar. This is to cope with the
    experimental multi-document validation in the XSLT2 skeleton.

https://github.com/Schematron/schematron/blob/e16ecc490f9c6429f275ea268279787a71ff298f/trunk/schematron/code/iso_svrl_for_xslt2.xsl#L42

dmj commented 5 years ago

Okay, I see. Do you know if the svrl:active-pattern/@‍‍document will be included in an updated ISO spec?

tgraham-antenna commented 5 years ago

@AndrewSales?

dmj commented 5 years ago

Sorry, to clarify: Schematron 2016 already defines svrl:active-pattern@‍documents in Annex D.2

# only active patterns are reported
active-pattern =
     element active-pattern {
         attribute id { xsd:NMTOKEN }?,
         attribute documents { text }?,
         attribute name { text }?,
         attribute role { xsd:NMTOKEN }?,
         empty
     }

There it also reads:

Elements related to the same subordinate document should be grouped together.

The skeleton implementation creates a @‍document (singular) attribute with the document URI of the initial context document (i.e. not the subordinate document).

I think I am at a loss here.

AndrewSales commented 5 years ago

As things stand, I would assume that the SVRL would indeed have to feature an active-pattern per subordinate document or set of subordinate documents with their IRIs only as the value of documents, in order to make explicit which context document(s) the fired-rules that follow it in the group apply to.

I would be inclined to agree, @dmj (if my interpretation is correct), that this is not very clear from the text of the standard.

Perhaps it is safer at this point to allow active-pattern/@documents to stand, but also allow fired-rule/@document as you propose.

AndrewSales commented 4 years ago

Noting that attribute document { xsd:anyURI }? was scheduled for addition to the named pattern fired-rule in the 2020 standard, in order to address this technical defect in this (informative) Annex.