Text Encoding Fundamentals: Element list for RNG
author: Julia Flanders; Syd Bauman
language: en-US

Elements for basic RELAX NG for ODD files

This is a very brief reference sheet listing the handful of RELAX NG elements needed to create content models inside a TEI ODD file.

<ref>
- refers to an element or pattern definition, typically a TEI construct. The @name attribute points to the name of the model class, datatype (or other macro), or element being referenced. For example, the content model of <figure> is defined as follows:

<rng:choice>
  <rng:ref name="model.headLike"/>
  <rng:ref name="model.pLike"/>
  <rng:ref name="figDesc"/>
  <rng:ref name="model.graphicLike"/>
  <rng:ref name="model.egLike"/>
  <rng:ref name="floatingText"/>
  <rng:ref name="model.global"/>
</rng:choice>

<oneOrMore>
- one or more of each of the constructs indicated by the children elements, in the order they are specified. Example:

<!-- our <list>s are always the label-item pair kind -->
<content>
  <rng:oneOrMore>
    <rng:ref name="label"/>
    <rng:ref name="item"/>
  </rng:oneOrMore>
</content>

<zeroOrMore>
- zero or more of each of the constructs indicated by the children elements, in the order they are specified. Example:

<!-- our <bibl>s have very simple, strict content: -->
<content>
  <rng:ref name="title"/>
  <rng:zeroOrMore>
    <rng:ref name="author"/>
  </rng:zeroOrMore>
  <rng:ref name="biblScope"/>
</content>

<optional>
- zero or one of each of the constructs indicated by the children elements, in the order specified. Example:

<!-- <persName> -->
<content>
  <rng:ref name="forename"/>
  <rng:optional>
    <rng:ref name="nameLink"/>
  </rng:optional>
  <rng:ref name="surname"/>
</content>

<group>
- one and only one of each of the constructs indicated by the children elements, in the order specified. Example:

<content>
  <rng:ref name="title"/>
  <rng:choice>
    <rng:group>
      <rng:ref name="funder"/>
      <rng:ref name="principal"/>
    </rng:group>
    <rng:group>
      <rng:ref name="meeting"/>
      <rng:ref name="sponsor"/>
    </rng:group>
  </rng:choice>
</content>

<interleave>
- each of the constructs indicated by the child elements is required, but they may appear in any order. Note that DTDs cannot be generated if <interleave> is used. Example:

<rng:interleave>
  <rng:ref name="model.headLike"/>
  <rng:ref name="figDesc"/>
  <rng:ref name="graphic"/>
  <rng:optional>
    <rng:ref name="model.pLike"/>
  </rng:optional>
</rng:interleave>

<choice>
- one and only one of the constructs indicated by the child elements. Example:

<!-- our <dimensions> are either H and W (rectangles) or just R (circles) -->
<rng:choice>
  <rng:group>
    <rng:ref name="height"/>
    <rng:ref name="width"/>
  </rng:group>
  <rng:ref name="dim"/>
</rng:choice>

Copyleft 2010 Syd Bauman and Julia Flanders; source available at http://www.wwp.brown.edu/encoding/current/handouts/elementList_rng.tei.