[tei-council] numbered divs, a proposed solution

Sebastian Rahtz sebastian.rahtz at oucs.ox.ac.uk
Sat Jan 6 10:39:58 EST 2007


You can hardly have failed to notice the argument on TEI-L
which revolved around Ron vd B's innocuous expectation
that if he  deleted mumbered divs in his ODD, he would
get a valid DTD.

I know one should not solve a general problem by dealing
with a special case case, but I also think that there is a time for
compromise and practicality, so I have a firm proposal which
I'd like you to consider. I claim it will solve this problem
at a relatively small cost, compared to the public
embarassment this will keep on causing.

The idea is that we much simplify the content model of <body>,
<front> and <back> to allow _either_ paragraph-like
objects (macro.component) _or_
div-like objects (as well as the existing top and bottom elements).
The "div-like" would be expressed as a new
class model.divLike, and its membership would be
div, div0, div1 and divGen.

Good things:
 1. so long as at least one member of the class exists,  any other can 
be safely deleted
 2. you can create new objects easily which will be allowed inside <body>

Bad things:
 1. you can interleave div, div1 and div0 ad lib.
 2. if model.divLike is entirely empty, it fails at present cos of 
globals being ambiguous

Strange things:
 1. you can interleave div and divGen ad lib. that strikes me as
   moderately desirable.


To deal with the first bad thing, I have added a Schematron test
which detects silly combinations. The second requires
some more jiggery-pokery; I think it's solvable with a lot
of patience.

My proposal for the content model of <body> is below. The fully-worked
example is in P5/Test/testfand.odd in Subversion.

Views? I have not tried integrating this into the main TEI and running
all tests, but I have a tei_all with these changes and done
some obvious tests which threw up no funnies.

I take it as axiomatic that we cannot simply leave the
current setup as it is. We must do _something_ to allow
the simple case of "delete numbered divs" to work.

  <content>
    <rng:group>
<!-- first, some globals or divWrappers interleaved -->
      <rng:zeroOrMore>
    <rng:choice>
      <rng:group>
        <rng:ref name="model.divWrapper"/>
      </rng:group>
      <rng:group>
        <rng:ref name="model.global"/>
      </rng:group>
    </rng:choice>
      </rng:zeroOrMore>

      <rng:group>
    <!--
         now a choice between
        
         a) some components, with globals after them if needed
         b) some divLike things, with globals after them if needed
    -->
    <!-- a -->
    <rng:choice>
      <rng:oneOrMore>
        <rng:group>
          <rng:group>
        <rng:ref name="macro.component"/>
          </rng:group>
          <rng:zeroOrMore>
        <rng:ref name="model.global"/>
        </rng:zeroOrMore>
        </rng:group>
      </rng:oneOrMore>
      <!-- b -->     
      <rng:oneOrMore>
        <rng:group>
          <rng:group>
        <rng:ref name="model.divLike"/>
          </rng:group>
          <rng:zeroOrMore>
        <rng:ref name="model.global"/>
        </rng:zeroOrMore>
        </rng:group>
      </rng:oneOrMore>

    </rng:choice>
      </rng:group>
      <!-- end of choice -->
     
      <!-- finally, some divWrappers -->
      <rng:zeroOrMore>
    <rng:ref name="model.divWrapper.bottom"/>
      </rng:zeroOrMore>
    </rng:group>

    <s:pattern xmlns:s="http://www.ascc.net/xml/schematron" 
name="pattern.body">
      <s:rule context="tei:body">
    <s:report test="tei:div and (tei:div0 or tei:div1)">
      You cannot mix numbered divs with unnumbered divs in body
    </s:report>
    <s:report test="tei:div0 and tei:div1">
      You cannot mix div0 with div1 at the same level in body
    </s:report>
      </s:rule>
    </s:pattern>

  </content>

-- 
Sebastian Rahtz      

Information Manager, Oxford University Computing Services
13 Banbury Road, Oxford OX2 6NN. Phone +44 1865 283431

OSS Watch: JISC Open Source Advisory Service
http://www.oss-watch.ac.uk




More information about the tei-council mailing list