RELAX NG: Coding requirements for element domain modules

Vocabulary modules that define element domains must define an extension pattern for each element that is extended by the domain. These patterns are used when including the domain module in a document-type shell.

All vocabulary and constraint modules must document their @domains attribute contribution. The value of the contribution is constructed according to the rules found in @domains attribute rules and syntax. The OASIS grammar files use a <domainsContribution> element to document the contribution; this element is used to help enable generation of DTD and XSD grammar files. An XML comment or <a:documentation> element can also be used.

For each element type that is extended by the element domain module, the module must define a domain extension pattern. The pattern consists of a choice group of references to element-type name patterns, with one reference to each extension of the base element type.

The name of the pattern uses the following format, where shortName is the short name for the domain, and elementName is the name of the element that is extended:

shortName-d-elementName

For example, the following pattern extends the <ph> element type by adding the specializations of <ph> that are defined in the highlighting domain:

  <define name="hi-d-ph">
    <choice>
      <ref name="b.element"/>
      <ref name="i.element"/>
      <ref name="sup.element"/>
      <ref name="sub.element"/>
      <ref name="tt.element"/>
      <ref name="u.element"/>
    </choice>
  </define>

For each element type that is extended by the element domain module, the module extends the element type pattern with a @combine value of "choice" that contains a reference to the domain extension pattern. Because the pattern uses a @combine value of "choice", the effect is that the domain-provided elements are automatically added to the effective content model of the extended element in any grammar that includes the domain module.

For example, the following pattern adds the highlighting domain specializations of the <ph> element to the content model of the <ph> element:

  <define name="ph" combine="choice">
    <ref name="hi-d-ph"/>
  </define>

Was this helpful?