<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="globalattributes">
        <head>Global Attributes</head>
        <p>Just as any XML element, TEI elements can carry one or more attributes which provide additional information, and function as their qualifiers and quantifiers. The full list of all attributes defined in TEI is available as <ref target="https://tei-c.org/release/doc/tei-p5-doc/en/html/REF-ATTS.html">Appendix D Attributes</ref> of the TEI Guidelines. A couple of these attributes can occur on all TEI elements: those are defined as <soCalled>global attributes</soCalled>, in the <ident type="class">att.global</ident> attribute class, and its subclasses. Not all of those subclasses are always present for all TEI documents (see <ptr type="crossref" target="TBED08v00.htm#modulesElements"/> for more information on including TEI modules in a TEI schema), but a number of attribute classes are <emph>always</emph> present in any TEI schema (since they are defined in the <ident type="moduke">tei</ident> module). Together, they define 11 global attributes, available on any TEI element:
          <list type="gloss">
            <label>
                            <ident type="class">att.global</ident>
                        </label>
            <item>
              <list type="gloss">
                <label>
                                    <att>xml:id</att>
                                </label>
                <item>provides a unique identifier for an element.</item>
                <label>
                                    <att>n</att>
                                </label>
                <item>provides a number or other label for an element, which does not need to be unique within the document.</item>
                <label>
                                    <att>xml:lang</att>
                                </label>
                <item>indicates the language of an element using a <soCalled>tag</soCalled> generated according to <ref target="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">BCP 47</ref>.</item>
                <label>
                                    <att>xml:base</att>
                                </label>
                <item>provides a base URI reference with which applications can resolve relative URI references into absolute URI references.</item>
                <label>
                                    <att>xml:space</att>
                                </label>
                <item>signals an intention about how white space should be managed by applications.</item>
              </list>
            </item>
            <label>
                            <ident type="class">att.global.rendition</ident>
                        </label>
            <item>
              <list type="gloss">
                <label>
                                    <att>rend</att>
                                </label>
                <item>indicates how the element was rendered or presented in the source text.</item>
                <label>
                                    <att>style</att>
                                </label>
                <item>contains an expression in some formal style definition language which defines the rendering or presentation used for this element in the source text.</item>
                <label>
                                    <att>rendition</att>
                                </label>
                <item>points to a description of the rendering or presentation used for this element in the source text.</item>
              </list>
            </item>
            <label>
                            <ident type="class">att.global.responsibility</ident>
                        </label>
            <item>
              <list type="gloss">
                <label>
                                    <att>cert</att>
                                </label>
                <item>signifies the degree of certainty associated with the intervention or interpretation</item>
                <label>
                                    <att>resp</att>
                                </label>
                <item>indicates the agency responsible for the intervention or interpretation</item>
              </list>
            </item>
            <label>
                            <ident type="class">att.global.source</ident>
                        </label>
            <item>
              <list type="gloss">
                <label>
                                    <att>source</att>
                                </label>
                <item>specifies the source from which some aspect of this element is drawn.</item>
              </list>
            </item>
          </list>
        </p>
        <div xml:id="xmlid">
          <head>
                        <att>xml:id</att>
                    </head>
          <p>The <att>xml:id</att> attribute provides a unique identifier for the element bearing the attribute. The identifier must be unique in the whole XML document. If there is another element in the XML document bearing the same identifier as a value for this attribute, a validating XML parser will signal a syntax error. Conforming to the World Wide Web Consortium’s XML Recommendations, the attribute value must be a legal name, which means that it must start with a letter or the underscore character and contain no characters other than letters, digits, hyphens, underscores, full stops, and certain combining and extension characters. The use of the colon in a unique identifier is forbidden as it has the specific purpose of indicating namespace prefixes in XML.</p>
          <floatingText type="challenge">
            <body/>
          </floatingText>
        </div>
        <div xml:id="n">
          <head>
                        <att>n</att>
                    </head>
          <p>The <att>n</att> attribute also provides an identifier for an element, but its value doesn’t need to be a legal XML name. This means that they don’t have to be unique inside the XML document and they may start with and contain any character. Typically <att>n</att> is used to number or label elements. All <att>n</att> values in the following examples are legal:
            <figure xml:id="example42">
              <egXML xmlns="http://www.tei-c.org/ns/Examples" rend="omit-ns">
                <p n="1">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.</p>
                <p n="p2">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.</p>
                <p n="paraghraph 3">He hoped his fellow members of the Royal Academy weren't even going to notice his absence.</p>
              </egXML>
              <head type="legend">Providing informal labels for elements in the <att>n</att> attribute.</head>
            </figure>
          </p>
          <p>Although by no means mandatory, it often makes sense to enrich the structural units of a document (e.g., lines in a poem) with some sort of identification (in <att>xml:id</att>) or reference mechanism (in <att>n</att>). Of course, when dealing with complex and/or long documents, this labelling could become a rather demanding task in itself. Fortunately, this job can be done automatically by an XML processor, which can identify the sequential position of one element within another in an XML document without any additional tagging. Instead of manually providing mechanical references for a long poem or collection of poems, you could as well instruct an XML processor to either enrich the TEI encoding and add <att>xml:id</att> or <att>n</att> attributes with appropriate values, or to automatically deduct such reference systems from your markup and present them while rendering the document (e.g., in an HTML version of a poem).</p>
          <note type="reference">See section <ref target="https://tei-c.org/release/doc/tei-p5-doc/en/html/CO.html#CORS2">3.10.2 Creating New Reference Systems</ref> of the TEI Guidelines for guidance on creating sensible reference systems for text structures.</note>
        </div>
        <div xml:id="xmllang">
          <head>
                        <att>xml:lang</att>
                    </head>
          <p>The language of the content of a given element may be documented as the value of an <att>xml:lang</att> attribute. If it is not specified, the value is inherited from that of the immediately enclosing element. Therefore, it is simplest to specify the base language of a text on the <gi>TEI</gi> element and override that with <att>xml:lang</att> attributes only for those elements with a different language.
            <figure xml:id="example43">
              <egXML xmlns="http://www.tei-c.org/ns/Examples">
                <p xml:lang="en">'Plenty of options', he thought, sat on a bench and opened the book he had taken from the Whoopledywhaaian National Library. It was titled 'While thou art here', by Sir Edmund Peckwood. While reading the first sentence, his placid expression turned to a certain <foreign xml:lang="fr">je ne sais quoi</foreign>: '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.'</p>
              </egXML>
              <head type="legend">Specifying the language of the content of an element with the <att>xml:lang</att> attribute.</head>
            </figure>
          </p>
          <note type="reference">The values for the <att>xml:lang</att> attribute must be constructed in a uniform way as explained in section <ref target=" https://tei-c.org/release/doc/tei-p5-doc/en/html/CH.html#CHSH">vi.1. Language identification</ref> of the TEI Guidelines.</note>
                </div>
        <div xml:id="base">
          <head>
                        <att>xml:base</att>
                    </head>
          <p>Many TEI attributes take a URI reference as their value. Those can be either <term>absolute</term> (starting with the protocol, such as <code>http:</code>, <code>ftp:</code>, ...) or <term>relative</term> (either starting with a local file name, such as <code>names.xml</code>, and/or a fragment identifier, such as <code>#EV</code>). The <att>xml:base</att> attribute can be used to set a context for all relative URLs appearing within the element on which the <att>xml:base</att> attribute is specified. For example:
            <figure xml:id="example44">
              <egXML xmlns="http://www.tei-c.org/ns/Examples">
                <p xml:base="../xml/">'Plenty of options', he thought, sat on a bench and opened the book he had taken from the Whoopledywhaaian National Library<note n="1" place="foot" type="authorial">The National Library of Whoopledywhaa was founded in 1886 with the acquisition of the library of the late King Anthony.</note>. It was titled 'While thou art here', by Sir Edmund Peckwood<note type="editorial" resp="names.xml#EV">The manuscript reads 'Petwood'.</note>. While reading the first sentence, his placid expression turned to a certain je ne sais quoi: '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.'</p>
              </egXML>
              <head type="legend">Providing a context for the resolution of relative URIs with the <att>xml:base</att> attribute.</head>
            </figure>
            In this example, the relative URI <code>names.xml#EV</code> will be resolved to a subfolder named <ident type="file">xml</ident> of the folder containing the electronic text containing that reference. Hence, the URI reference will be evaluated as  <code>../xml/names.xml#EV</code>.</p>
        </div>
        <div xml:id="space">
          <head>
                        <att>xml:space</att>
                    </head>
          <p>This global attribute provides a mechanism for indicating to systems processing an XML file how they should treat white space. It has two possible values: <val>default</val> (white space will most probably be normalised during processing) and <val>preserve</val> (white space should be preserved as is during processing).
            <figure xml:id="example45">
              <egXML xmlns="http://www.tei-c.org/ns/Examples" xml:space="preserve">
                <choice>
                  <sic xml:space="preserve">white     space</sic>
                  <corr>white space</corr>
                </choice>
              </egXML>
              <head type="legend">Specifying how white space should be handled during processing with <att>xml:space</att>.</head>
            </figure>
            In this example, the <att>xml:space</att> on the <gi>sic</gi> element specifies that the (unusual) spacing in the original form should be preserved when this document is being processed.</p>
          <p>Notice, how the <att>xml:space</att> attribute is rarely used in TEI documents because such layout features are generally expressed more confidently, and descriptively, with TEI elements such as <gi>lb</gi> or <gi>space</gi>, or using the renditional attributes described next.</p>
        </div>        
        <div xml:id="rend">
                    <head>
                        <att>rend</att>
                    </head>
          <p>The <att>rend</att> attribute is used to document information about the physical appearance of the text in the source. In the following example, it is used to indicate that the title, the French phrase, and the name of the Royal Academy are printed in italics:
            <figure xml:id="example46">
              <egXML xmlns="http://www.tei-c.org/ns/Examples">
                <p>'Plenty of options', he thought, sat on a bench and opened the book he had taken from the Whoopledywhaaian National Library. It was titled <title type="m" rend="italics">While thou art here</title>, by Sir Edmund Peckwood. While reading the first sentence, his placid expression turned to a certain <hi rend="italics">je ne sais quoi</hi>: 'For the first time in twenty-five years, Dr Burt Diddledygook decided not to turn up to the annual meeting of the <name type="organisation" rend="italics">Royal Academy of Whoopledywhaa</name>.'</p>
              </egXML>
              <head type="legend">Indicating specific renditional features in the source text with <att>rend</att>.</head>
            </figure>
            The value for <att>rend</att> can take the form of a white space separated list of idiosyncratic keywords, which an XML processor can act upon when rendering the document. This means that multiple renditional features can be enumerated with <att>rend</att>.
          </p>
        </div>
        <div xml:id="style">
                    <head>
                        <att>style</att>
                    </head>
          <p>The <att>style</att> attribute can also be used to document information about the physical appearance of the text in the source. Contrary to <att>rend</att>, <att>style</att> must express this information in some formal style definition language. This will most often be <ref target="https://www.w3.org/TR/CSS2/">CSS</ref>, although others are possible as well. The name of that formal style definition language can be given in the <gi>encodingDesc</gi> section of the header, in a <gi>styleDefDecl</gi> element: 
            <figure xml:id="example47">
              <egXML xmlns="http://www.tei-c.org/ns/Examples">
                <TEI>
                  <teiHeader>
                    <!-- ... -->
                    <encodingDesc>
                      <styleDefDecl scheme="css" schemeVersion="2.1"/>
                      <!-- ... -->
                    </encodingDesc>
                    <!-- ... -->
                  </teiHeader>
                  <text>
                    <body>
                      <!-- ... -->
                      <p>'Plenty of options', he thought, sat on a bench and opened the book he had taken from the Whoopledywhaaian National Library. It was titled <title type="m" style="font-style:italic;">While thou art here</title>, by Sir Edmund Peckwood. While reading the first sentence, his placid expression turned to a certain <hi rend="italics">je ne sais quoi</hi>: 'For the first time in twenty-five years, Dr Burt Diddledygook decided not to turn up to the annual meeting of the <name type="organisation" style="font-weight:italic;">Royal Academy of Whoopledywhaa</name>.'</p>
                      <!-- ... -->                      
                    </body>
                  </text>
                </TEI>
              </egXML>
              <head type="legend">Indicating specific renditional features in the source text with <att>rend</att>.</head>
            </figure>
          </p>
        </div>
        <div xml:id="rendition">
                    <head>
                        <att>rendition</att>
                    </head>
          <p>Whereas the <att>rend</att> and <att>style</att> attributes documents the appearance of text locally, i.e., attached to an element, the <att>rendition</att> attribute points to a description of the rendering or appearance in the header (<gi>teiHeader</gi>), more specifically inside a <gi>tagsDecl</gi> inside the <gi>encodingDesc</gi> section. This is done in free text or using a formal language inside a <gi>rendition</gi> element. This way, only one description of the rendering must be given, which can be referred to with <att>rendition</att> attributes on elements in the text. The advantage of this system becomes clear when both <att>rendition</att> and <att>rend</att> are used for occurrences of a given element. While the former refers to an overall description of the appearance of that element in the source, the latter documents the local deviation from that generally imposed rendition.</p>
          <p>In the following example, we see a description of the overall rendering of <gi>hi</gi> elements in a document, in the <gi>tagsDecl</gi> element inside the <gi>encodingDesc</gi> section of <gi>teiHeader</gi>. The <att>gi</att> attribute of <gi>tagUsage</gi> names the elements for which the rendition described in <gi>rendition</gi> is documented. The formal namespace in which the tags described in <gi>tagUsage</gi> are defined, must be specified in the <att>name</att> attribute of a surrounding <gi>namespace</gi> element. The value of the <att>rendition</att> attribute of <gi>tagUsage</gi> refers to <gi>rendition</gi> by way of the latter’s <att>xml:id</att> attribute. This way, all <gi>hi</gi> elements inside <gi>text</gi> have the style, defined as <val>italic</val>, as their default rendition. In the following example, the third occurrence of the <gi>hi</gi> element in the text documents a deviant rendition, by means of the <att>rend</att> attribute.
            <figure xml:id="example48">
              <egXML xmlns="http://www.tei-c.org/ns/Examples">
                <TEI>
                  <teiHeader>
                    <!-- ... -->
                    <encodingDesc>
                      <!-- ... -->
                      <tagsDecl>
                        <rendition xml:id="italic">font-style:italic;</rendition>
                        <namespace name="http://www.tei-c.org/ns/1.0">
                          <tagUsage gi="hi" rendition="#italic"/>
                        </namespace>
                      </tagsDecl>
                      <!-- ... -->
                    </encodingDesc>
                    <!-- ... -->
                  </teiHeader>
                <text>
                  <body>
                    <!-- ... -->
                    <p>'Plenty of options', he thought, sat on a bench and opened the book he had taken from the Whoopledywhaaian National Library. It was titled <hi>While thou art here</hi>, by Sir Edmund Peckwood. While reading the first sentence, his placid expression turned to a certain <hi>je ne sais quoi</hi>: 'For the first time in twenty-five years, Dr Burt Diddledygook decided not to turn up to the annual meeting of the <hi rend="roman">Royal Academy of Whoopledywhaa</hi>.'</p>
                    <!-- ... -->
                  </body>
                </text>
                </TEI>
              </egXML>
              <head type="legend">Referring to central definitions of rendition styles with <att>rendition</att>.</head>
            </figure>
          </p>
        </div>
        <div xml:id="cert">
          <head>
                        <att>cert</att>
                    </head>
          <p>The <att>cert</att> attribute provides a method of indicating the encoder’s certainty concerning an intervention or interpretation represented by the markup. This can be done with an informal classification, such as <val>high</val>, <val>medium</val>, or <val>low</val>, or more formal systems, such as a probability scale between <val>1</val> and <val>0</val>.
            <figure xml:id="example49">
              <egXML xmlns="http://www.tei-c.org/ns/Examples">
                <choice>
                  <sic cert="low">Pekwood</sic>
                  <sic cert="high">Petwood</sic>
                  <corr>Peckwood</corr>
                </choice>
              </egXML>
              <head type="legend">Expressing certainty for an editorial interpretation with <att>resp</att>.</head>
            </figure>
            In this example, two alternatives are presented for the transcription of the original form, with an indication of the certainty in their respective <att>cert</att> attributes.
          </p>
        </div>
        <div xml:id="resp">
          <head>
                        <att>resp</att>
                    </head>
          <p>The <att>resp</att> attribute is used to indicate the person or agency considered responsible for some aspects of the information encoded by an element. This responsible party should be identified formally in an element with an <att>xml:id</att> attribute, either in the same document, or elsewhere.
            <figure xml:id="example50">
              <egXML xmlns="http://www.tei-c.org/ns/Examples">
                <choice>
                  <sic cert="low">Pekwood</sic>
                  <sic cert="high">Petwood</sic>
                  <corr resp="#EV">Peckwood</corr>
                </choice>
              </egXML>
              <head type="legend">Identifying the person responsible for a correction with <att>resp</att>.</head>
            </figure>
          </p>
        </div>
        <div xml:id="source">
          <head>
                        <att>source</att>
                    </head>
          <p>The <att>source</att> attribute is used to indicate the source of an element and its content, for example by pointing to a bibliograhpic citation.
            <figure xml:id="example51">
              <egXML xmlns="http://www.tei-c.org/ns/Examples">
                <text>
                  <body>
                    <!-- ... -->
                    <p>
                                            <q>Plenty ​of ​options</q>,​ ​he ​thought,​ ​sat ​on ​a ​bench ​and ​opened ​the ​book ​he ​had ​taken ​from ​the ​Whoopledywhaaian ​National ​Library.​ ​It ​was ​titled ​'​While ​thou ​art ​here'​,​ ​by ​Sir ​Edmund ​Peckwood.​ ​While ​reading ​the ​first ​sentence,​ ​his ​placid ​expression ​turned ​to ​a ​certain ​<foreign>je ​ne ​sais ​quoi</foreign>:​ ​<quote source="#peckwood1935">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.​</quote>
                                        </p>
                    <!-- ... -->
                  </body>
                  <back>
                    <div type="bibliography">
                      <listBibl>
                        <!-- ... -->
                        <bibl xml:id="peckwood1935">
                                                    <author>Peckwood, Edmund</author>. <date when="1935">1935</date>. <title level="m">While thou art here</title>. <pubPlace>​Whoopledywhaa</pubPlace>: <publisher>​Whoopledywhaaian Press</publisher>.</bibl>
                        <!-- ... -->
                      </listBibl>
                    </div>
                  </back>
                </text>
              </egXML>
              <head type="legend">Formally indicating the source for a quotation with <att>source</att>.</head>
            </figure>
          </p>
        </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>