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. This reference brings that element or construct into the schema. 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 child elements, in the order they are specified. In this example, a <list> consists of one or more pairings of <label> and <item>:

<!-- content model for <list> -->
   <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 child elements, in the order they are specified. In this example, a <bibl> contains a required <title> followed by zero or more <author> elements, followed by a required <biblscope>:

<!-- content model for <bibl> -->
<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 child elements, in the order specified. In this example, the <nameLink> element is optional, while the <forename> and <surname> elements are required:

<!-- content model for <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 child elements, in the order specified. In this example, we are given a choice between either a <funder> followed by a <principal>, or a <meeting> followed by a <sponsor>. The <group> element causes each of these subgroupings to be treated as a single unit within the <choice>:

<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. In this example, a simplified <figure> element contains a required head-like element, a required <figDesc>, a required <graphic>, and an optional paragraph-like element, but they may occur in any order:

<!-- content model for <figure> -->
   <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. In this example, we may choose to represent dimensions as either <height> and <width> (useful for rectangles) or as a single <dim> element (useful for the radius of circles). The <group> element allows the height/width option to act as a single unit within the content model:

<!-- content model for <dimensions> -->
<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.neu.edu/outreach/seminars/_current/handouts/elementList_rng.tei.