FAND2 replace

From TEIWiki

Jump to: navigation, search

FAND (Front for the Abolition of Numbered Divs) is of historical interest only. Modern versions (> 0.6 version of P5) of TEI allow the use of unnumbered divs (div) or the legacy use of numbered divs (div1, div2, div3, div4, div5, div6 and div7) throughout the document. There are files in the Test Directory to demonstrate this.

See also: FAND0 FAND1_hack


This ODD demonstrates how to remove numbered <div>s without causing non-deterministic DTDs to be generated. We do this by re-writing the content models of <front>, <body>, and <back>. The advantage is this works quite well. The disadvantage is that if the original content model of any of those elements is changed (e.g., by a bug-fix released by TEI), we need to update the content model here correspondingly.

<?xml version="1.0"?>
<?oxygen RNGSchema="http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_odds.rnc" type="compact"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0"
  xmlns:rng="http://relaxng.org/ns/structure/1.0" xml:lang="en">
  <teiHeader>
    <fileDesc>
      <titleStmt>
        <title>
          <choice>
            <abbr>FAND</abbr>
            <expan>Front Against Numbered Divs</expan>
          </choice> via replacing content models </title>
        <author>Syd Bauman</author>
      </titleStmt>
      <publicationStmt>
        <p>Intended for publication as an example for TEI users. No warrantee
          express or implied.</p>
      </publicationStmt>
      <sourceDesc>
        <p>Based on TEI Lite (from Sourceforge revision r1953 of <date
            value="2006-12-05T02:35:47-05:00"/>)</p>
      </sourceDesc>
    </fileDesc>
    <revisionDesc>
      <change who="#sbauman.emt" date="2006-12-15T09:50">started</change>
    </revisionDesc>
  </teiHeader>
  <text>

    <body>
      <p>This ODD is intended as an example of how to replace the content models
        of <gi>front</gi>, <gi>body</gi>, and <gi>back</gi> so that one can rid
        a schema of numbered <gi>div</gi>s and simultaneously avoid
        non-deterministic DTDs. It is not intended to be actually used for
        encoding.</p>

      <schemaSpec ident="teiFandReplace" start="teiCorpus TEI text body">
        <!-- Note that instances that use <text> or <body> as the -->
        <!-- root element are definitionally not conforming TEI -->
        <!-- documents; nonetheless, doing so can be very useful -->
        <!-- for testing. -->

        <!-- modules: same as for TEI Lite -->
        <moduleRef key="tei"/>
        <moduleRef key="core"/>
        <moduleRef key="header"/>
        <moduleRef key="textstructure"/>
        <moduleRef key="figures"/>
        <moduleRef key="linking"/>
        <moduleRef key="analysis"/>
        <moduleRef key="tagdocs"/>

        <!-- FAND: redefine content of <front> -->
        <elementSpec ident="front" mode="change" module="textxtructure">
          <content>
            <rng:group xmlns:rng="http://relaxng.org/ns/structure/1.0">
              <rng:zeroOrMore>
                <rng:choice>
                  <rng:ref name="model.frontPart"/>
                  <rng:ref name="model.global"/>
                </rng:choice>
              </rng:zeroOrMore>
              <rng:optional>
                <rng:choice>
                  <rng:group>
                    <rng:group>
                      <rng:ref name="model.pLike.front"/>
                    </rng:group>
                    <rng:zeroOrMore>
                      <rng:choice>
                        <rng:ref name="model.pLike.front"/>
                        <rng:ref name="titlePage"/>
                        <rng:ref name="model.global"/>
                      </rng:choice>
                    </rng:zeroOrMore>
                  </rng:group>
                  <rng:group>
                    <rng:ref name="div"/>
                    <rng:zeroOrMore>
                      <rng:choice>
                        <rng:ref name="div"/>
                        <rng:ref name="model.frontPart"/>
                        <rng:ref name="model.global"/>
                      </rng:choice>
                    </rng:zeroOrMore>
                  </rng:group>
                  <!-- this comment is the FAND difference
                 <rng:group>
                    <rng:ref name="div1"/>
                    <rng:zeroOrMore>
                      <rng:choice>
                        <rng:ref name="div1"/>
                        <rng:ref name="model.frontPart"/>
                        <rng:ref name="model.global"/>
                      </rng:choice>
                    </rng:zeroOrMore>
                  </rng:group>
                  end FAND fix -->
                </rng:choice>
              </rng:optional>
            </rng:group>
          </content>
        </elementSpec>
        <!-- FAND: redefine content of <body> -->
        <elementSpec ident="body" mode="change" module="textstructure">
          <content>
            <rng:group>
              <!-- this <group> exists just so odd2dtd can get parens in right place  -->
              <rng:zeroOrMore>
                <rng:choice>
                  <rng:ref name="model.divWrapper"/>
                  <rng:ref name="model.global"/>
                </rng:choice>
              </rng:zeroOrMore>
              <rng:choice>
                <rng:group>
                  <rng:oneOrMore>
                    <rng:group>
                      <rng:ref name="macro.component"/>
                    </rng:group>
                    <rng:zeroOrMore>
                      <rng:ref name="model.global"/>
                    </rng:zeroOrMore>
                  </rng:oneOrMore>
                  <rng:group>
                    <rng:zeroOrMore>
                      <rng:ref name="divGen"/>
                      <rng:zeroOrMore>
                        <rng:ref name="model.global"/>
                      </rng:zeroOrMore>
                    </rng:zeroOrMore>
                    <rng:optional>
                      <rng:choice>
                        <rng:group>
                          <rng:ref name="div"/>
                          <rng:zeroOrMore>
                            <rng:choice>
                              <rng:ref name="div"/>
                              <rng:ref name="divGen"/>
                              <rng:ref name="model.global"/>
                            </rng:choice>
                          </rng:zeroOrMore>
                        </rng:group>
                        <!-- FAND strikes again
                        <rng:group>
                          <rng:ref name="div0"/>
                          <rng:zeroOrMore>
                            <rng:choice>
                              <rng:ref name="div0"/>
                              <rng:ref name="divGen"/>
                              <rng:ref name="model.global"/>
                            </rng:choice>
                          </rng:zeroOrMore>
                        </rng:group>
                        <rng:group>
                          <rng:ref name="div1"/>
                          <rng:zeroOrMore>
                            <rng:choice>
                              <rng:ref name="div1"/>
                              <rng:ref name="divGen"/>
                              <rng:ref name="model.global"/>
                            </rng:choice>
                          </rng:zeroOrMore>
                        </rng:group>
                        end FAND deletion -->
                      </rng:choice>
                    </rng:optional>
                  </rng:group>
                </rng:group>
                <rng:group>
                  <rng:zeroOrMore>
                    <rng:ref name="divGen"/>
                    <rng:zeroOrMore>
                      <rng:ref name="model.global"/>
                    </rng:zeroOrMore>
                  </rng:zeroOrMore>
                  <rng:choice>
                    <rng:group>
                      <rng:ref name="div"/>
                      <rng:zeroOrMore>
                        <rng:choice>
                          <rng:ref name="div"/>
                          <rng:ref name="divGen"/>
                          <rng:ref name="model.global"/>
                        </rng:choice>
                      </rng:zeroOrMore>
                    </rng:group>
                    <!-- FAND removes the following 
                  <rng:group>
                    <rng:ref name="div0"/>
                    <rng:zeroOrMore>
                      <rng:choice>
                        <rng:ref name="div0"/>
                        <rng:ref name="divGen"/>
                        <rng:ref name="model.global"/>
                      </rng:choice>
                    </rng:zeroOrMore>
                  </rng:group>
                  <rng:group>
                    <rng:ref name="div1"/>
                    <rng:zeroOrMore>
                      <rng:choice>
                        <rng:ref name="div1"/>
                        <rng:ref name="divGen"/>
                        <rng:ref name="model.global"/>
                      </rng:choice>
                    </rng:zeroOrMore>
                  </rng:group>
                  end FAND deletion -->
                  </rng:choice>
                </rng:group>
              </rng:choice>
              <rng:zeroOrMore>
                <rng:ref name="model.divWrapper.bottom"/>
              </rng:zeroOrMore>
            </rng:group>
          </content>
        </elementSpec>
        <!-- FAND: redefine content of <back> -->
        <elementSpec ident="back" mode="change" module="textstructure">
          <content>
            <rng:group xmlns:rng="http://relaxng.org/ns/structure/1.0">
              <rng:zeroOrMore>
                <rng:choice>
                  <rng:ref name="model.frontPart"/>
                  <rng:ref name="model.global"/>
                  <rng:ref name="model.divWrapper"/>
                </rng:choice>
              </rng:zeroOrMore>
              <rng:optional>
                <rng:choice>
                  <rng:group>
                    <rng:ref name="div"/>
                    <rng:zeroOrMore>
                      <rng:choice>
                        <rng:ref name="div"/>
                        <rng:ref name="model.frontPart"/>
                        <rng:ref name="model.global"/>
                      </rng:choice>
                    </rng:zeroOrMore>
                  </rng:group>
                  <!-- FAND strikes this section out
                  <rng:group>
                    <rng:ref name="div1"/>
                    <rng:zeroOrMore>
                      <rng:choice>
                        <rng:ref name="div1"/>
                        <rng:ref name="model.frontPart"/>
                        <rng:ref name="model.global"/>
                      </rng:choice>
                    </rng:zeroOrMore>
                  </rng:group>
                  end FAND deletion -->
                </rng:choice>
              </rng:optional>
              <rng:zeroOrMore>
                <rng:ref name="model.divWrapper.bottom"/>
              </rng:zeroOrMore>
            </rng:group>
          </content>
        </elementSpec>

        <!-- element deletion: same as for TEI Lite -->
        <elementSpec ident="ab" mode="delete" module="linking"/>
        <elementSpec ident="altGrp" mode="delete" module="linking"/>
        <elementSpec ident="altIdent" mode="delete" module="tagdocs"/>
        <elementSpec ident="alt" mode="delete" module="linking"/>
        <elementSpec ident="analytic" mode="delete" module="core"/>
        <elementSpec ident="attDef" mode="delete" module="tagdocs"/>
        <elementSpec ident="attList" mode="delete" module="tagdocs"/>
        <elementSpec ident="attRef" mode="delete" module="tagdocs"/>
        <elementSpec ident="biblItem" mode="delete" module="core"/>
        <elementSpec ident="biblStruct" mode="delete" module="core"/>
        <elementSpec ident="binaryObject" mode="delete" module="core"/>
        <elementSpec ident="broadcast" mode="delete" module="header"/>
        <elementSpec ident="cb" mode="delete" module="core"/>
        <elementSpec ident="classes" mode="delete" module="tagdocs"/>
        <elementSpec ident="classSpec" mode="delete" module="tagdocs"/>
        <elementSpec ident="cl" mode="delete" module="analysis"/>
        <elementSpec ident="c" mode="delete" module="analysis"/>
        <elementSpec ident="content" mode="delete" module="tagdocs"/>
        <elementSpec ident="correction" mode="delete" module="header"/>
        <elementSpec ident="datatype" mode="delete" module="tagdocs"/>
        <elementSpec ident="defaultVal" mode="delete" module="tagdocs"/>
        <elementSpec ident="desc" mode="delete" module="core"/>
        <elementSpec ident="distinct" mode="delete" module="core"/>
        <elementSpec ident="div0" module="textstructure" mode="delete"/>
        <elementSpec ident="div1" module="textstructure" mode="delete"/>
        <elementSpec ident="div2" module="textstructure" mode="delete"/>
        <elementSpec ident="div3" module="textstructure" mode="delete"/>
        <elementSpec ident="div4" module="textstructure" mode="delete"/>
        <elementSpec ident="div5" module="textstructure" mode="delete"/>
        <elementSpec ident="div6" module="textstructure" mode="delete"/>
        <elementSpec ident="div7" module="textstructure" mode="delete"/>
        <elementSpec ident="egXML" mode="delete" module="tagdocs"/>
        <elementSpec ident="elementSpec" mode="delete" module="tagdocs"/>
        <elementSpec ident="equipment" mode="delete" module="header"/>
        <elementSpec ident="equiv" mode="delete" module="core"/>
        <elementSpec ident="exemplum" mode="delete" module="tagdocs"/>
        <elementSpec ident="fsdDecl" mode="delete" module="header"/>
        <elementSpec ident="headItem" mode="delete" module="core"/>
        <elementSpec ident="headLabel" mode="delete" module="core"/>
        <elementSpec ident="hyphenation" mode="delete" module="header"/>
        <elementSpec ident="imprimatur" mode="delete" module="textstructure"/>
        <elementSpec ident="interpretation" mode="delete" module="header"/>
        <elementSpec ident="joinGrp" mode="delete" module="linking"/>
        <elementSpec ident="join" mode="delete" module="linking"/>
        <elementSpec ident="linkGrp" mode="delete" module="linking"/>
        <elementSpec ident="link" mode="delete" module="linking"/>
        <elementSpec ident="listRef" mode="delete" module="tagdocs"/>
        <elementSpec ident="macroSpec" mode="delete" module="tagdocs"/>
        <elementSpec ident="measure" mode="delete" module="core"/>
        <elementSpec ident="meeting" mode="delete" module="core"/>
        <elementSpec ident="memberOf" mode="delete" module="tagdocs"/>
        <elementSpec ident="metDecl" mode="delete" module="header"/>
        <elementSpec ident="metSym" mode="delete" module="header"/>
        <elementSpec ident="m" mode="delete" module="analysis"/>
        <elementSpec ident="moduleRef" mode="delete" module="tagdocs"/>
        <elementSpec ident="moduleSpec" mode="delete" module="tagdocs"/>
        <elementSpec ident="monogr" mode="delete" module="core"/>
        <elementSpec ident="normalization" mode="delete" module="header"/>
        <elementSpec ident="phr" mode="delete" module="analysis"/>
        <elementSpec ident="postBox" mode="delete" module="core"/>
        <elementSpec ident="postCode" mode="delete" module="core"/>
        <elementSpec ident="quotation" mode="delete" module="header"/>
        <elementSpec ident="quote" mode="delete" module="core"/>
        <elementSpec ident="recording" mode="delete" module="header"/>
        <elementSpec ident="recordingStmt" mode="delete" module="header"/>
        <elementSpec ident="remarks" mode="delete" module="tagdocs"/>
        <elementSpec ident="schemaSpec" mode="delete" module="tagdocs"/>
        <elementSpec ident="scriptStmt" mode="delete" module="header"/>
        <elementSpec ident="segmentation" mode="delete" module="header"/>
        <elementSpec ident="series" mode="delete" module="core"/>
        <elementSpec ident="spanGrp" mode="delete" module="analysis"/>
        <elementSpec ident="span" mode="delete" module="analysis"/>
        <elementSpec ident="specDesc" mode="delete" module="tagdocs"/>
        <elementSpec ident="specGrp" mode="delete" module="tagdocs"/>
        <elementSpec ident="specGrpRef" mode="delete" module="tagdocs"/>
        <elementSpec ident="specList" mode="delete" module="tagdocs"/>
        <elementSpec ident="state" mode="delete" module="header"/>
        <elementSpec ident="stdVals" mode="delete" module="header"/>
        <elementSpec ident="street" mode="delete" module="core"/>
        <elementSpec ident="stringVal" mode="delete" module="tagdocs"/>
        <elementSpec ident="tag" mode="delete" module="tagdocs"/>
        <elementSpec ident="tagsDecl" mode="delete" module="header"/>
        <elementSpec ident="timeline" mode="delete" module="linking"/>
        <elementSpec ident="valDesc" mode="delete" module="tagdocs"/>
        <elementSpec ident="valItem" mode="delete" module="tagdocs"/>
        <elementSpec ident="valList" mode="delete" module="tagdocs"/>
        <elementSpec ident="variantEncoding" mode="delete" module="header"/>
        <elementSpec ident="when" mode="delete" module="linking"/>
        <elementSpec ident="w" mode="delete" module="analysis"/>
      </schemaSpec>
    </body>
  </text>
</TEI>
Personal tools