Content models: order?

  <content>
    <sequence>
      <elementRef key="head" minOccurs="0" maxOccurs="1"/>
      <alternate minOccurs="1" maxOccurs="unbounded">
        <elementRef key="p"/>
        <elementRef key="quote"/>
      </alternate>
      <alternate minOccurs="0" maxOccurs="unbounded">
        <elementRef key="bibl"/>
        <elementRef key="ref"/>
      </alternate>
    </sequence>
  </content>

We can also control the order in which elements will appear. By default, they appear in the order that they are listed in the ODD file.

So what if we want things to be allowed to appear in any order? We can nest the TEI <alternate> other elements in the ODD. This means that any <elementRef> elements that occur within the <alternate> element can be placed in any order.

Think through the logic from outside to inside: we are making our notes contain one or more paragraphs/quotes, followed by zero or more <bibl>/<ref> elements.

Note that order still applies here: so the unlimited combination of <p> and <quote> elements is immediately followed by zero or more choices between <bibl> or <ref>. Once you have a <bibl> or a <ref>, you can’t put any more quotes or paragraphs, according to this code snippet.

Introduction to Writing ODDs slide 23 of 24
© 2010 Syd Bauman, Julia Flanders, and the Women Writers Project This TEI-encoded XML file is available under the terms of the Creative Commons Attribution-ShareAlike 3.0 (Unported) license.