severity

Table of Contents

Declaration
Related GitHub issue(s)
Sample usage
Commentary

Element context(s)

This attribute is optional and expresses the relative importance of an assertion.

Clause 5.5.16 (severity attribute)

The following values are reserved for use and without further definition: fatal, error, warning, info.

If the value of a severity attribute given in a schema is a variable reference, its value shall be dynamically evaluated. This mechanism is provided to enable the severity value to vary, for example according to the selected phase and its in-scope variables.

Declaration

severity = attribute severity{ text }?

Related GitHub issue(s)

Add attribute named e.g. 'severity' to schematron with well defined semantics for reporting severity levels

Sample usage

Example 6. severity attribute: element report

Assertion:

<sch:report test='true()' severity='warning'>...</sch:report>

SVRL output:

<svrl:successful-report test='true()' severity='warning'>...</svrl:successful-report>

Example 7. severity attribute: element assert

Assertion:

<sch:assert test='false()' severity='error'>...</sch:assert>

SVRL output:

<svrl:failed-assert test='false()' severity='error'>...</svrl:failed-assert>

Example 8. severity attribute: user-defined value

Assertion:

<sch:assert test='false()' severity='M-5093-K4'>...</sch:assert>

SVRL output:

<svrl:failed-assert test='false()' severity='M-5093-K4'>...</svrl:failed-assert>

Example 9. severity attribute: dynamic evaluation

Schema:

<sch:schema defaultPhase='phase'>
  <sch:ns prefix='a' uri='b'/>
  <sch:let name='c' value='d'/>
  <sch:phase id='phase'>
    <sch:let name='dynamic-severity' value='"bar"'/>
    <sch:active pattern='foo'/>
  </sch:phase>
  <sch:pattern id='foo'>
    <sch:rule context='*'>
      <sch:assert test='false()' severity='$dynamic-severity'>...</sch:assert>
    </sch:rule>
  </sch:pattern>
</sch:schema>

SVRL output for failed assertion:

<svrl:failed-assert test='false()' severity='bar'>...</svrl:failed-assert>

Commentary

This value of this attribute (along with flag and role) can now be dynamically evaluated on output to SVRL.

For details, see Dynamic evaluation of attributes flag, role and severity.