[tei-council] solving unnumbered divs (bis)

James Cummings James.Cummings at oucs.ox.ac.uk
Tue Jan 9 07:23:54 EST 2007


Sebastian Rahtz wrote:
> So I now have an ODD which can delete any or  all of div0, div1, div and
> divGen,
> and the RELAXNG, DTD and XSD schemas all work as expected. div0|div1 and
> div cannot co-exist.
> 
> The price I have had to pay is inventing *3* new classes,
> model.divLike, model.ndivLike, and model.divGenLike.
> It's a hideous price to pay, but it works.

I think that Sebastian's solution is good and elegant.  The only problem it
causes is in fact a great opportunity.  Currently his solution allows me to
validate a document whose body looks like this:

    <body>
      <div1>
            <pb/>
            <head>test</head>
            <p/>
      </div1>

      <div0>
            <pb/>
            <head>test</head>
            <p/>
      </div0>
    </body>

As you can see this allows me to have *both* div1 and div0 at the top level.

However, I don't think his elegant solution should be thrown out with the
bathwater.  No, no, instead this is an opportunity to solve yet another TEI
problem.  If we remove div1 from the model.ndivLike class, then the solution
works perfectly.

The only side effect is that people are unable to start a document using div1
... in my mind this is hardly a drawback.  (While I have no preference of
starting with div0 or div1, my cummings compromise for the month is that
removing div1 from the class is a much easier change than removing div0 from the
class and entirely.) Moreover, if people really want to start their documents at
div1, all they have to do is add it to the model.ndivLike class (and optionally
remove div0 from said class).

This is not a flaw, it is an opportunity.

-James

> 
> So, if you don't mind those 3 new classes,
> and you don't find it strange have a DTD like this:
> 
> <!ELEMENT body (((%model.divWrapper;) | (%model.global; |
> _DUMMY_model.divGenLike))*,(((%macro.component;),(%model.global; |
> _DUMMY_model.divGenLike)*)+ | (_DUMMY_model.divLike,(%model.global; |
> _DUMMY_model.divGenLike)*)+ | ((%model.ndivLike;),(%model.global; |
> _DUMMY_model.divGenLike)*)+),(%model.divWrapper.bottom;)*)>
> 
> then I claim victory, pending a full test.
> 
> Here is the final <body> content model:
> 
>    <rng:group>
> <!-- first, some globals or divWrappers interleaved -->
>      <rng:zeroOrMore>
>    <rng:choice>
>      <rng:group>
>        <rng:ref name="model.divWrapper"/>
>      </rng:group>
>      <rng:group>
>        <rng:choice>
>          <rng:ref name="model.global"/>
>          <rng:ref name="model.divGenLike"/>
>        </rng:choice>
>      </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
>         c) some ndivLike 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:choice>
>          <rng:ref name="model.global"/>
>          <rng:ref name="model.divGenLike"/>
>        </rng:choice>
>          </rng:zeroOrMore>
>        </rng:group>
>      </rng:oneOrMore>
> 
>      <!-- c -->          <rng:oneOrMore>
>        <rng:group>
>          <rng:group>
>        <rng:ref name="model.ndivLike"/>
>          </rng:group>
>          <rng:zeroOrMore>
>        <rng:choice>
>          <rng:ref name="model.global"/>
>          <rng:ref name="model.divGenLike"/>
>        </rng:choice>
>          </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>
> 


-- 
Dr James Cummings, Oxford Text Archive, University of Oxford
James dot Cummings at oucs dot ox dot ac dot uk



More information about the tei-council mailing list