<TEI xmlns="http://www.tei-c.org/ns/1.0">
  <teiHeader>
    <fileDesc>
      <titleStmt>
        <title type="main">TEI by Example</title>
        <title type="sub">Module 1: Common Structure, Elements, and Attributes</title>
        <author xml:id="EV">Edward Vanhoutte</author>
        <author xml:id="RvdB">Ron Van den Branden</author>
        <editor xml:id="MT">Melissa Terras</editor>
        <sponsor>Association for Literary and Linguistic Computing (ALLC)</sponsor>
        <sponsor>Centre for Data, Culture and Society, University of Edinburgh, UK</sponsor> 
        <sponsor>Centre for Digital Humanities (CDH), University College London, UK</sponsor>
        <sponsor>Centre for Computing in the Humanities (CCH), King’s College London, UK</sponsor>
        <sponsor>Centre for Scholarly Editing and Document Studies (CTB) , Royal Academy of Dutch Language and Literature, Belgium</sponsor>
        <funder>
          <address>
            <addrLine>Centre for Scholarly Editing and Document Studies (CTB)</addrLine>
            <addrLine>Royal Academy of Dutch Language and Literature</addrLine>
            <addrLine>Koningstraat 18</addrLine>
            <addrLine>9000 Gent</addrLine>
            <addrLine>Belgium</addrLine>
          </address>
          <email>ctb@kantl.be</email>
        </funder>
        <principal>Edward Vanhoutte</principal>
        <principal>Melissa Terras</principal>
      </titleStmt>
      <publicationStmt>
        <publisher>Centre for Scholarly Editing and Document Studies (CTB) , Royal Academy of Dutch Language and Literature, Belgium</publisher>
        <distributor>Centre for Scholarly Editing and Document Studies (CTB) , Royal Academy of Dutch Language and Literature, Belgium</distributor>
        <pubPlace>Gent</pubPlace>
        <address>
          <addrLine>Centre for Scholarly Editing and Document Studies (CTB)</addrLine>
          <addrLine>Royal Academy of Dutch Language and Literature</addrLine>
          <addrLine>Koningstraat 18</addrLine>
          <addrLine>9000 Gent</addrLine>
          <addrLine>Belgium</addrLine>
        </address>
        <availability status="free">
          <p>Licensed under a <ref target="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution ShareAlike 3.0 License</ref>
                    </p>
        </availability>
        <date when="2010-07-09">9 July 2010</date>
      </publicationStmt>
      <seriesStmt>
        <title>TEI by Example.</title>
        <respStmt>
          <name>Edward Vanhoutte</name>
          <resp>editor</resp>
        </respStmt>
        <respStmt>
          <name>Ron Van den Branden</name>
          <resp>editor</resp>
        </respStmt>
        <respStmt>
          <name>Melissa Terras</name>
          <resp>editor</resp>
        </respStmt>
      </seriesStmt>
      <sourceDesc>
        <p>Digitally born</p>
      </sourceDesc>
    </fileDesc>
    <encodingDesc>
      <projectDesc>
        <p>TEI by Example offers a series of freely available online tutorials walking individuals through the different stages in marking up a document in TEI (Text Encoding Initiative). Besides a general introduction to text encoding, step-by-step tutorial modules provide example-based introductions to eight different aspects of electronic text markup for the humanities. Each tutorial module is accompanied with a dedicated examples section, illustrating actual TEI encoding practise with real-life examples. The theory of the tutorial modules can be tested in interactive tests and exercises.</p>
      </projectDesc>
    </encodingDesc>
    <profileDesc>
      <langUsage>
        <language ident="en-GB">en-GB</language>
      </langUsage>
    </profileDesc>
    <revisionDesc>
      <change when="2020-06-22" who="#RvdB">technical revision</change>
      <change when="2010-07-13" who="#RvdB">
                <list>
                    <item>added distinction <gi>gi</gi> — <tag>gi scheme="..."</tag> — <gi>tag</gi>
                    </item>
        <item>final spellcheck</item>
                </list>
            </change>
      <change when="2010-07-09" who="#RvdB">release</change>
      <change when="2009-11-20" who="#EV">general contents completed</change>
      <change when="2009-11-13" who="#EV">intermediate update</change>
      <change when="2009-11-12" who="#EV">intermediate update</change>
      <change when="2009-11-05" who="#EV">intermediate update</change>
      <change when="2009-10-30" who="#EV">intermediate update</change>
      <change when="2009-10-28" who="#EV">intermediate update</change>
      <change when="2009-06-10" who="#EV">Authoring</change>
    </revisionDesc>
  </teiHeader>
  <text xml:id="TBED01v00" type="tutorials">
    <body>
            <div xml:id="generalstructure">
        <head>General TEI Document Structure</head>
        <p>The TEI makes use of XML as its governing metalanguage. This means that all TEI metadata are expressed as XML elements and thus comply with the World Wide Web Consortium XML Recommendation. Information (plain text) is contained in XML elements, delimited by start tags (e.g., <tag type="start">TEI</tag>) and end tags (e.g., <tag type="end">TEI</tag>). Additional information to these XML elements can be given in attributes, consisting of a name (e.g., <code>xml:id</code>) and a value (e.g., <val>text1</val>). XML comments are delimited by start markers (<code>&lt;!--</code>) and end markers (<code>--&gt;</code>).<note>In these TEI by Example tutorials, names of TEI components are formatted in a specific way:
          <list rend="bulleted">
            <item>
                                <term>Element</term> names are printed in monospace between pointy brackets, e.g., <gi>TEI</gi>
                            </item>
            <item>
                                <term>Attribute</term> are displayed in monospace, and prefixed with the <soCalled>at</soCalled> sign, e.g., <att>n</att>
                            </item>
            <item>
                                <term>Class</term>, <term>datatype</term>, and <term>macro</term> names are displayed in monospace, e.g., <ident type="class">att.global</ident>
                            </item>
          </list>
          All of these components are being presented as hyperlinks to their declaration in the TEI Guidelines. This should make it easier to look up the reference documentation.</note>
                </p>
        <p>A full TEI document consists of one single <gi>TEI</gi> element, which consists of two major components:
          <list rend="bulleted">
            <item>
                            <gi>teiHeader</gi>: an element containing all the metadata describing the document.</item>
            <item>
                            <gi>text</gi>: an element containg the actual document</item>
          </list>
          This common structure is mandatory for all <soCalled>standard</soCalled> TEI documents. 
          <figure xml:id="example1">
            <egXML xmlns="http://www.tei-c.org/ns/Examples">
              <TEI>
                <teiHeader>
                  <!---...-->
                </teiHeader>
                <text>
                  <!--...-->
                </text>
              </TEI>
            </egXML>
            <head type="legend">The minimal structure of a TEI document.</head>
          </figure>
        </p>
        <p>This is an example of a TEI XML text, containing both information and meta-information. This example, as any TEI text, is recognizable as a TEI text by the outermost <gi>TEI</gi> element, which is declared in the dedicated TEI namespace (<ident type="ns">http://www.tei-c.org/ns/1.0</ident>). Before proceeding, let’s first have a look at the namespace declaration. In the previous example, the TEI namespace is declared as the <soCalled>default</soCalled> namespace, i.e., without any <term>prefix</term>. It could have been expressed equally as follows:
          <figure xml:id="example2">
            <egXML xmlns="http://www.tei-c.org/ns/Examples">
              <tei:TEI xmlns:tei="http://www.tei-c.org/ns/1.0_TBEeg_">
                <tei:teiHeader>
                  <!---...-->
                </tei:teiHeader>
                <text>
                  <!--...-->
                </text>
              </tei:TEI>
            </egXML>
            <head type="legend">A TEI document with mixed namespace prefixes.</head>
          </figure>
        </p>
        <p>Here, the namespace declaration <code>xmlns:tei="http://www.tei-c.org/ns/1.0"</code> on the <tag>TEI</tag> element binds the TEI namespace URI (<ident type="ns">http://www.tei-c.org/ns/1.0</ident>) to the namespace prefix <code>tei</code>. All descendant elements using that prefix before the actual element name belong to this namespace (e.g., <tag>tei:teiHeader</tag>). Yet, the <tag>text</tag> element contains its own namespace declaration: <code>xmlns="http://www.tei-c.org/ns/1.0</code>, only this time it is binding it to an <emph>empty</emph> namespace prefix. All descendant elements without a namespace prefix (in the <soCalled>default</soCalled> namespace), will belong to this namespace. Since both namespace declarations in the previous example are referencing the same namespace URI, the previous example is equivalent to the first.</p>
        <p>Because the TEI namespace is vital to any TEI element, the examples in these TEI by Example tutorials will explicitly render their top-level element(s) with a <soCalled>default</soCalled> (i.e., without namespace prefix) namespace declaration for the TEI namespace URI. In order not to hamper legibility, no namespace prefix will be used, and the namespace declaration won’t be repeated on any descendant elements.</p>
        <div xml:id="teiHeader">
          <head>TEI Header</head>
          <p>The TEI header (<gi>teiHeader</gi>) is mandatory and contains descriptive meta-information about the document. The <gi>teiHeader</gi> minimally contains a description of the electronic file inside a (<gi>fileDesc</gi>). The latter element consists of three mandatory components:
            <list rend="bulleted">
              <item>the title statement (<gi>titleStmt</gi>), providing information about the title (<gi>title</gi>), author (<gi>author</gi>), and others responsible for the electronic text</item>
              <item>the publication statement (<gi>publicationStmt</gi>), providing publication details about the electronic text in a structured way or as prose inside a paragraph (<gi>p</gi>)</item>
              <item>a description of the source (<gi>sourceDesc</gi>), documenting bibliographic details about the electronic text’s material source (if any) in a structured way or in a prose paragraph (<gi>p</gi>)</item>
            </list>
            <figure xml:id="example3">
              <egXML xmlns="http://www.tei-c.org/ns/Examples">
                <teiHeader>
                  <fileDesc>
                    <titleStmt>
                      <title>The Strange Adventures of Dr. Burt Diddledygook: a machine-readable transcription</title>
                      <respStmt>
                        <resp>editor</resp>
                        <name xml:id="EV">Edward Vanhoutte</name>
                      </respStmt>
                    </titleStmt>
                    <publicationStmt>
                      <p>Not for distribution.</p>
                    </publicationStmt>
                    <sourceDesc>
                      <p>Transcribed from the diaries of the late Dr. Roy Offire.</p>
                    </sourceDesc>
                  </fileDesc>
                </teiHeader>
              </egXML>
              <head type="legend">A minimal TEI header.</head>
            </figure>
          </p>
          <note type="reference">See <ptr type="crossref" target="TBED02v00.htm"/> for detailed information on <gi>teiHeader</gi>.</note>
        </div>
        <div xml:id="text">
          <head>Text</head>
          <div xml:id="tei_body">
            <head>Body</head>
            <p>The actual text (<gi>text</gi>) contains a single text of any kind. This commonly contains the actual text and other encodings. A text <gi>text</gi> minimally contains a text body (<gi>body</gi>). The body contains lower-level text structures like paragraphs (<gi>p</gi>), or different structures for text genres other than prose: lines (<gi>l</gi>) for poetry, speeches (<gi>sp</gi>) for drama.
              <figure xml:id="example4">
                <egXML xmlns="http://www.tei-c.org/ns/Examples">
                  <text>
                    <body>
                      <p>For the first time in twenty-five years, Dr Burt Diddledygook decided not to turn up to the annual meeting of the Royal Academy of Whoopledywhaa (RAW). It was a sunny day in late September 1960 bang on noontime and Dr Burt was looking forward to a stroll in the park instead. He hoped his fellow members of theRAW weren't even going to notice his absence.</p>
                    </body>
                  </text>
                </egXML>
                <head type="legend">A <gi>body</gi> element with paragraphs.</head>
              </figure>
            </p>
          </div>
          <div xml:id="front">
            <head>Front</head>
            <p>Next to the <gi>body</gi>, a text can optionally contain front matter which may be encoded with <gi>front</gi>. Clear examples are title pages, headers, prefaces, or dedications. Prologues in drama or forewords and introductions in prose may also be considered prefatory material. May, because the encoder may choose simply not to encode the front matter of a text as such. With exception of the title page, for which the TEI defines specific elements, front matter should be encoded using the same elements as the rest of a text. This means that there are no specific elements to encode prefaces, dedications, abstracts, frontispieces etc. Instead, either numbered or un-numbered divisions <gi>div</gi> with an attribute <att>type</att> are used to distinguish between the different components of a <gi>front</gi> section. The following suggested values for the <att>type</att> attribute may be used for this purpose: 
              <list rend="bulleted">
                <item>
                                    <val>preface</val>: a foreword or preface addressed to the reader</item>
                <item>
                                    <val>ack</val>: a formal declaration of acknowledgement by the author</item>
                <item>
                                    <val>dedication</val>: a formal offering or dedication of a text by the author</item>
                <item>
                                    <val>abstract</val>: a summary of the content of a text as continuous prose</item>
                <item>
                                    <val>contents</val>: a table of contents. A <gi>list</gi> element should be used to mark its structure</item>
                <item>
                                    <val>frontispiece</val>: a pictorial frontispiece, possibly including some text</item>
              </list>
              <figure xml:id="example5">
                <egXML xmlns="http://www.tei-c.org/ns/Examples">
                  <front>
                    <div type="dedication">
                      <p>In memory of Lisa Wheeman.</p>
                    </div>
                    <div type="contents">
                      <head>Table of Contents</head>
                      <list>
                        <item>I. The Decision</item>
                        <item>II. The Fuss</item>
                        <item>III. The Celebration</item>
                      </list>
                    </div>
                  </front>
                </egXML>
                <head type="legend">A <gi>front</gi> section with a dedication and table of contents.</head>
              </figure>
            </p>
          </div>
          <div xml:id="back">
            <head>Back</head>
            <p>All back matter to a text may be grouped within <gi>back</gi>. As is the case with <gi>front</gi>, either numbered or un-numbered divisions <gi>div</gi> with a <att>type</att> attribute are used to distinguish the different components. The following attribute values may be supplied for the <att>type</att> in order to distinguish various kinds of division characteristic of back matter: 
              <list rend="bulleted">
                <item>
                                    <val>appendix</val>: an appended self-contained section of a work, often providing additional information or text</item>
                <item>
                                    <val>glossary</val>: contains a list <gi>list</gi>of terms and their explanations</item>
                <item>
                                    <val>notes</val>: a section in which textual or other kinds of notes are gathered together</item>
                <item>
                                    <val>bibliogr</val>: contains a list of bibliographical citations <gi>listBibl</gi>
                                </item>
                <item>
                                    <val>index</val>: any form of index to the work</item>
                <item>
                                    <val>colophon</val>: a statement appearing at the end of a book describing the conditions of its physical production</item>
              </list>
              <figure xml:id="example6">
                <egXML xmlns="http://www.tei-c.org/ns/Examples">
                  <back>
                    <div type="colophon">
                      <p>Typeset in Haselfoot 37 and Henry 8. Printed and bound by Whistleshout, South Africa.</p>
                    </div>
                  </back>
                </egXML>
                <head type="legend">A <gi>back</gi> section with a colophon.</head>
              </figure>
            </p>
          </div>
          <div xml:id="fullexample">
            <head>Full Example <gi>text</gi>
                        </head>
            <figure xml:id="example7">
              <egXML xmlns="http://www.tei-c.org/ns/Examples">
                <text>
                  <front>
                    <div type="dedication">
                      <p>In memory of Lisa Wheeman.</p>
                    </div>
                    <div type="contents">
                      <head>Table of Contents</head>
                      <list>
                        <item>I. The Decision</item>
                        <item>II. The Fuss</item>
                        <item>III. The Celebration</item>
                      </list>
                    </div>
                  </front>
                  <body>
                    <p>For the first time in twenty-five years, Dr Burt Diddledygook decided not to turn up to the annual meeting of the Royal Academy of Whoopledywhaa (RAW). It was a sunny day in late September 1960 bang on noontime and Dr Burt was looking forward to a stroll in the park instead. He hoped his fellow members of the RAW weren't even going to notice his absence.</p>
                  </body>
                  <back>
                    <div type="colophon">
                      <p>Typeset in Haselfoot 37 and Henry 8. Printed and bound by Whistleshout, South Africa.</p>
                    </div>
                  </back>
                </text>
              </egXML>
              <head type="legend">A full <gi>text</gi> structure.</head>
            </figure>
          </div>
          <div xml:id="composite">
            <head>Unitary or Composite Texts</head>
            <p>Apart from simple texts, TEI provides means to encode composite texts, either by grouping structurally related texts in a <gi>group</gi> element inside <gi>text</gi>, or treating them as a corpus of diverse texts, using <gi>teiCorpus</gi> as the outermost element.</p>
          </div>
          <div xml:id="summary1">
            <head>Summary</head>
            <p>The following example shows the empty framework of a basic TEI document structure:
              <figure xml:id="example8">
                <egXML xmlns="http://www.tei-c.org/ns/Examples">
                  <TEI>
                    <teiHeader>
                      <fileDesc>
                        <titleStmt>
                          <title>
                            <!--Title-->
                          </title>
                        </titleStmt>
                        <publicationStmt>
                          <p>
                            <!--Publication Information-->
                          </p>
                        </publicationStmt>
                        <sourceDesc>
                          <p>
                            <!--Information about the source-->
                          </p>
                        </sourceDesc>
                      </fileDesc>
                    </teiHeader>
                    <text>
                      <body>
                        <!--Some structural division, paragraph, line group, speech, ...-->
                      </body>
                    </text>
                  </TEI>
                </egXML>
                <head type="legend">A minimal structure for the <gi>TEI</gi> element.</head>
              </figure>
            </p>
            <p>The following example fills this empty framework with the text of the examples:
              <figure xml:id="example9">
                <egXML xmlns="http://www.tei-c.org/ns/Examples">
                  <TEI>
                    <teiHeader>
                      <fileDesc>
                        <titleStmt>
                          <title>The Strange Adventures of Dr. Burt Diddledygook: a machine-readable transcription</title>
                          <respStmt>
                            <resp>editor</resp>
                            <name xml:id="EV">Edward Vanhoutte</name>
                          </respStmt>
                        </titleStmt>
                        <publicationStmt>
                          <p>Not for distribution.</p>
                        </publicationStmt>
                                                <sourceDesc>
                          <p>Transcribed from the diaries of the late Dr. Roy Offire.</p>
                        </sourceDesc>
                                            </fileDesc>
                    </teiHeader>
                    <text>
                      <front>
                        <div type="dedication">
                          <p>In memory of Lisa Wheeman.</p>
                        </div>
                        <div type="contents">
                          <head>Table of Contents</head>
                          <list>
                            <item>I. The Decision</item>
                            <item>II. The Fuss</item>
                            <item>III. The Celebration</item>
                          </list>
                        </div>
                      </front>
                      <body>
                        <p>For the first time in twenty-five years, Dr Burt Diddledygook decided not to turn up to the annual meeting of the Royal Academy of Whoopledywhaan (RAW). It was a sunny day in late September 1960 bang on noontime and Dr Burt was looking forward to a stroll in the park instead. He hoped his fellow members of the RAW weren't even going to notice his absence.</p>
                      </body>
                      <back>
                        <div type="colophon">
                          <p>Typeset in Haselfoot 37 and Henry 8. Printed and bound by Whistleshout, South Africa.</p>
                        </div>
                      </back>
                    </text>
                  </TEI>
                </egXML>
                <head type="legend">The example text encoded as a TEI text with <gi>TEI</gi>.</head>
              </figure>
            </p>
          </div>
        </div>
      </div>
        </body>
  </text>
  <!-- 
        $Date: 2020-07-08 02:33:20 +0200 (Wed, 08 Jul 2020) $
        $Id: TBED01v00.xml 425 2020-07-08 00:33:20Z ron.vandenbranden $  -->
</TEI>