diff --git a/schematron.rnc b/schematron.rnc index b1c784b..67c3fb8 100644 --- a/schematron.rnc +++ b/schematron.rnc @@ -1,4 +1,4 @@ -# Copyright © ISO/IEC 2017 +# Copyright © ISO/IEC 2024 # The following permission notice and disclaimer shall be included in all # copies of this XML schema ("the Schema"), and derivations of the Schema: @@ -26,7 +26,7 @@ namespace local = "" default namespace sch = "http://purl.oclc.org/dsdl/schematron" -start = schema +start = schema | library # Element declarations schema = @@ -34,11 +34,12 @@ schema = attribute id { xsd:ID }?, rich, attribute schemaVersion { non-empty-string }?, + attribute schematronEdition { non-empty-string }?, attribute defaultPhase { xsd:IDREF }?, attribute queryBinding { non-empty-string }?, (foreign - & inclusion* - & (title?, ns*, p*, let*, phase*, pattern+, p*, diagnostics?, properties?)) + & (inclusion | extends)* + & (title?, ns*, p*, param*, let*, phase*, abstract-rules*, (rule-set|pattern)+, p*, diagnostics?, properties?)) } active = element active { @@ -54,22 +55,23 @@ assert = attribute properties { xsd:IDREFS }?, rich, linkable, - (foreign & (text | name | value-of | emph | dir | span)*) + severity, + message } diagnostic = element diagnostic { attribute id { xsd:ID }, attribute role { roleValue }?, rich, - (foreign & (text | value-of | emph | dir | span)*) + message } diagnostics = element diagnostics { foreign & inclusion* & diagnostic* } dir = element dir { attribute value { "ltr" | "rtl" }?, - (foreign & text) + (foreign & (text | dynamic)*) } -emph = element emph { text } +emph = element emph { (foreign & (text | dynamic)*) } extends = element extends { (attribute rule { xsd:IDREF } @@ -79,9 +81,18 @@ extends = let = element let { attribute name { nameValue }, + attribute as { text }?, (attribute value { string } | foreign-element+) } +library = + element library { + attribute id { xsd:ID }?, + rich, + (foreign + & (inclusion | extends)* + & (title?, p*, param*, let*, abstract-rules*, (rule-set|pattern)*, p*, diagnostics?, properties?)) + } name = element name { attribute path { pathValue }?, @@ -103,32 +114,18 @@ p = param = element param { attribute name { nameValue }, - attribute value { non-empty-string } + attribute value { non-empty-string }? } pattern = element pattern { - attribute documents { pathValue }?, - rich, - (foreign - & inclusion* - & ((attribute abstract { "true" }, - attribute id { xsd:ID }, - title?, - (p*, let*, rule*)) - | (attribute abstract { "false" }?, - attribute id { xsd:ID }?, - title?, - (p*, let*, rule*)) - | (attribute abstract { "false" }?, - attribute is-a { xsd:IDREF }, - attribute id { xsd:ID }?, - title?, - (p*, param*)))) + rule-set-or-pattern } phase = element phase { attribute id { xsd:ID }, + attribute from { pathValue }?, + attribute when { pathValue }?, rich, (foreign & inclusion* & (p*, let*, active*)) } @@ -138,7 +135,7 @@ property = attribute id { xsd:ID }, attribute role { roleValue }?, attribute scheme { text }?, - (foreign & (text | name | value-of | emph | dir | span)*) + message } report = element report { @@ -149,7 +146,8 @@ report = attribute properties { xsd:IDREFS }?, rich, linkable, - (foreign & (text | name | value-of | emph | dir | span)*) + severity, + message } rule = element rule { @@ -158,20 +156,43 @@ rule = linkable, (foreign & inclusion* - & ((attribute abstract { "true" }, - attribute id { xsd:ID }, - let*, - (assert | report | extends | p)+) - | (attribute context { pathValue }, + & ((attribute context { pathValue }, + attribute visit-each { pathValue }?, attribute id { xsd:ID }?, attribute abstract { "false" }?, + title?, let*, (assert | report | extends | p)+))) } +abstract-rule = + element rule { + attribute flag { flagValue }?, + rich, + linkable, + (foreign + & inclusion* + & (attribute abstract { "true" }, + attribute id { xsd:ID }, + title?, + let*, + (assert | report | extends | p)+)) + } +abstract-rules = + element rules { + attribute id { xsd:ID }?, + rich, + title?, + p*, + abstract-rule+ + } +rule-set = + element group { + rule-set-or-pattern + } span = element span { attribute class { classValue }, - (foreign & text) + (foreign & (text | dynamic)*) } title = element title { (text | dir)* } value-of = @@ -205,6 +226,28 @@ foreign-element = | schema | text)* } +rule-set-or-pattern = + attribute documents { pathValue }?, + attribute role { roleValue }?, + rich, + (foreign + & inclusion* + & ((attribute abstract { "true" }, + attribute id { xsd:ID }, + title?, + (p*, param*, let*, rule*)) + | (attribute abstract { "false" }?, + attribute id { xsd:ID }?, + title?, + (p*, let*, rule*)) + | (attribute abstract { "false" }?, + attribute is-a { xsd:IDREF }, + attribute id { xsd:ID }?, + title?, + (p*, param*)))) +severity = attribute severity{ text }? +dynamic = value-of | name +message = (foreign & (text | dynamic | emph | dir | span)*) # Data types uriValue = xsd:anyURI @@ -213,7 +256,7 @@ exprValue = string fpiValue = string langValue = xsd:language roleValue = string -flagValue = string +flagValue = list{ token+ } nameValue = string # In the default query language binding, xsd:NCNAME diff --git a/schematron.sch b/schematron.sch index d31f5ab..7d3db6f 100644 --- a/schematron.sch +++ b/schematron.sch @@ -1,5 +1,5 @@ - + + Schema for Additional Constraints in Schematron This schema supplies some constraints in addition to those given in the @@ -29,29 +31,46 @@ AND SHOULD NOT BE INTERPRETED AS COMPLYING WITH THAT STANDARD." (RELAX NG Compact Syntax) Schema for Schematron. - The pattern + The pattern attribute of the active element shall match the id attribute of a pattern. - - The - is-a attribute of a pattern element shall match - the id attribute of an abstract pattern. - - - The rule + The rule attribute of an extends element shall match the id attribute of an abstract rule. - A variable name and an abstract pattern parameter should not use the same name. + + A parameter name should not use the same name as a parameter in the same scope. + + + + + The + is-a attribute of a pattern element shall match + the id attribute of an abstract pattern. + + The + name attribute of a pattern param element shall match + the name attribute of an abstract pattern param element. + + + + A pattern parameter value shall be specified. + + + A schema parameter value shall be specified. + diff --git a/schematron.xspec b/schematron.xspec new file mode 100644 index 0000000..cceb6d3 --- /dev/null +++ b/schematron.xspec @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/svrl.rnc b/svrl.rnc index 47ebd57..e182e78 100644 --- a/svrl.rnc +++ b/svrl.rnc @@ -1,4 +1,4 @@ -# Copyright © ISO/IEC 2019 +# Copyright © ISO/IEC 2024 # # The following permission notice and disclaimer shall be included in all # copies of this XML schema ("the Schema"), and derivations of the Schema: @@ -32,10 +32,16 @@ schematron-output = attribute title { text }?, attribute phase { xsd:NMTOKEN }?, attribute schemaVersion { text }?, - human-text*, - ns-prefix-in-attribute-values*, - (active-pattern, - (fired-rule, (failed-assert | successful-report)*)*)+ + attribute schematronEdition { text }?, + ( + (error+, human-text*) + | + (error*, + human-text*, + ns-prefix-in-attribute-values*, + (active-pattern-rule-set, + (fired-rule, (failed-assert | successful-report)*)*)+) + ) } # only namespaces from sch:ns need to be reported ns-prefix-in-attribute-values = @@ -44,23 +50,24 @@ ns-prefix-in-attribute-values = attribute uri { text }, empty } -# only active patterns are reported +# only active patterns and groups are reported active-pattern = element active-pattern { - attribute id { xsd:NCName }?, - attribute documents { text }?, - attribute name { text }?, - attribute role { string }?, - empty + active } +active-rule-set = + element active-group { + active + } # only rules that are fired are reported, fired-rule = element fired-rule { attribute id { xsd:NCName }?, attribute name { text }?, attribute context { text }, + attribute visit-each { text }?, attribute role { string }?, - attribute flag { string }?, + attribute flag { list{ token+ } }?, attribute document { xsd:anyURI }?, empty } @@ -68,17 +75,18 @@ fired-rule = diagnostic-reference = element diagnostic-reference { attribute diagnostic { xsd:NMTOKEN }, + attribute role { text }?, human-text } # only failed assertions are reported failed-assert = element failed-assert { - attlist.assert-and-report, diagnostic-reference*, property-reference*, human-text + assertion-message } # only successful asserts are reported successful-report = element successful-report { - attlist.assert-and-report, diagnostic-reference*, property-reference*, human-text + assertion-message } # property-reference property-reference = @@ -88,6 +96,14 @@ property-reference = attribute scheme { text }?, human-text } +# errors raised by the implementation +error = + element error { + attribute document { xsd:anyURI }, + attribute location { text }, + attribute code { text }?, + rich-text + } # human text human-text = element text { @@ -133,5 +149,21 @@ attlist.assert-and-report = attribute location { text }, attribute test { text }, attribute role { string }?, - attribute flag { string }? + attribute flag { list{ token+ } }?, + attribute severity { string }? + +# active patterns and rule-sets +active-pattern-rule-set = + active-pattern | active-rule-set +active = + attribute id { xsd:NCName }?, + attribute documents { text }?, + attribute name { text }?, + attribute role { string }?, + error* + +# assert and report message +assertion-message = + attlist.assert-and-report, diagnostic-reference*, property-reference*, human-text + start = schematron-output \ No newline at end of file diff --git a/svrl.sch b/svrl.sch index e7acb17..18e08aa 100644 --- a/svrl.sch +++ b/svrl.sch @@ -1,5 +1,5 @@