Table of Contents
This element has the same content model as element pattern
. Patterns and groups may be combined in a schema.
Clause 5.4.5 (
group
element)The
group
element has the same structure and semantics as elementpattern
[...], except that the if-then-else behaviour of evaluating rules within a pattern shall not apply (see 6.6).
Clause 6.6 Order and side-effects
A
rule
element acts as an if-then-else statement within each pattern. In the context of agroup
element (5.4.5), this behaviour shall not apply and a match shall be attempted instead against all the rule contexts it contains.
element 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 | extends)*
& (title?, ns*, p*, param*, let*, phase*, abstract-rules*, (rule-set|pattern)+, p*, diagnostics?, properties?))
}
element library {
attribute id { xsd:ID }?,
rich,
(foreign
& (inclusion | extends)*
& (title?, p*, param*, let*, abstract-rules*, (rule-set|pattern)*, p*, diagnostics?, properties?))
}
rule-set =
element group {
rule-set-or-pattern
}
Example 12. group
element
Given this instance document:
<foo/>
and this schema:
<sch:schema> <sch:group> <sch:rule context='*'> <sch:assert test='name() eq "bar"'>root element is <sch:name/></sch:assert> </sch:rule> <sch:rule context='foo'> <sch:report test='.'>should reach here</sch:report> </sch:rule> </sch:group> </sch:schema>
both rules will fire and their assertions will be evaluated, because within the context of a group
, all rules are evaluated. Contrast this with pattern
: in this instance, only the first rule would fire (if a child of pattern
), because the context has already been matched when the second rule's context is evaluated.