Chapter 9. The extends element

The extends element is a lesser counterpart of a pattern which instantiates an abstract pattern. This element allows a rule to be implemented within different contexts. The abstract rule is specified as shown in Example 9.1, “The specification of an abstract rule”

Example 9.1. The specification of an abstract rule

      <!-- Abstract rule has no context -->
    <iso:rule abstract="true" id="abs.rule1" role="abs">
      <iso:assert test="@idref = id(@idref)"
           > the idref value [<iso:value-of 
            select='@idref'/>] has no matching target</iso:assert>
    </iso:rule>


The rule has no context attribute. The abstract attribute has a value of true. This combination defines an abstract rule.

As with any rule, it must have the pattern element as its parent. However, the definition of the abstract rule, and its use (by the extends element, do not need to be within the same pattern.

This rule may contain as may assert and report children as needed. Thus a whole group of assertions can be re-used in different contexts, which is the purpose of the abstract rule. In order to make use of the abstract rule, the extends element is used, as shown in Example 9.2, “The use of an abstract rule, the extends element”

Example 9.2. The use of an abstract rule, the extends element

    <iso:rule context='para[@idref]'>
      <!-- Effectively inserts all the assertions from the rule/@abs.rule1 -->
      <iso:extends rule="abs.rule1" />
    </iso:rule>

Here the extends element refers to the abstract rule by means of the rule attribute. At this point in the file the assertions contained within the abstract rule will be actioned with the context specified by the rule parent of the extends element. In the example, the context will be any para which has an idref attribute.

The example is potentially useful in different contexts, since the document cross reference indicated by the use of id / idref could occur in many different contexts.

Legal Notice