Dynamic evaluation of attributes flag, role and severity

Table of Contents

Related GitHub issue(s)
Sample usage

Clauses 5.5.6 (role attribute), 5.5.14 (role attribute), 5.5.16 (severity attribute)

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

Related GitHub issue(s)

Ability for role value to be dynamic or different per phase

Sample usage

Example 15. Dynamic evaluation of attributes

The following schema

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

would result in SVRL containing this failed-assert:

<svrl:failed-assert test='false()' flag='foo' role='bar' severity='blort'/>