[tei-council] solving unnumbered divs (bis)

Sebastian Rahtz sebastian.rahtz at oucs.ox.ac.uk
Mon Jan 8 19:03:24 EST 2007


I am glad to say that the question of W3C schema allowing 
non-deterministic content
models appears to be a non-issue. My test XSD file seems to have come 
through
with no problem.

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.

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>

-- 
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