att.global

att.global provides attributes common to all elements in the TEI encoding scheme. [1.3.1.1. Global Attributes]
Module tei
Members NB TEI ab abbr abstract activity add addName additional adminInfo affiliation author biblStruct body byline catDesc catRef category cell change char charDecl choice closer collection compliment corr correspAction correspContext correspDesc creation custodialHist damage dateline del desc div divGen docAuthor docDate docEdition docImprint docTitle editor ellipsis emph enclosure encodingDesc epigraph expan extent facsimile figDesc figure fileDesc floruit foreign forename front fw g gap genName geo gloss graphic handNote handNotes handShift head hi history idno imprimatur imprint item l label langKnown langUsage language lb lg linkGrp list listBibl listChange listObject listOrg listPerson listPlace listPrefixDef localProp location locusGrp mapping mentioned milestone msContents msDesc msIdentifier msItem msName msPart name nameLink note noteGrp notesStmt num objectDesc objectName occupation opener org orgName orig origin p persName person persona physDesc place placeName postscript prefixDef profileDesc projectDesc ptr pubPlace publicationStmt publisher quote ref reg rendition repository request resp respStmt revisionDesc roleName row rs salute setting settingDesc settlement sic signed sourceDesc standOff subst summary supportDesc surface surfaceGrp surname surrogates table tagsDecl taxonomy teiHeader term text textClass title titlePage titlePart titleStmt trailer unclear w zone
Attributes Attributes lim.att.global.fragmentable (part) att.global.rendition (rendition) att.global.source (source)
xml:id (identifier) provides a unique identifier for the element bearing the attribute.
Status Optional
Datatype ID
Note
The xml:id attribute may be used to specify a canonical reference for an element; see section 3.11. Reference Systems.
n (number) gives a number (or other label) for an element, which is not necessarily unique within the document.
Status Optional
Datatype teidata.text
Note
The value of this attribute is always understood to be a single token, even if it contains space or other punctuation characters, and need not be composed of numbers only. It is typically used to specify the numbering of chapters, sections, list items, etc.; it may also be used in the specification of a standard reference system for the text.
xml:lang (language) indicates the language of the element content using a tag generated according to BCP 47.
Status Optional
Datatype teidata.language

<p>  … The consequences of
  this rapid depopulation were the loss of the last
<foreign xml:lang="rap">ariki</foreign> or chief
(Routledge 1920:205,210) and their connections to
  ancestral territorial organization.
</p>
Note
The xml:lang value will be inherited from the immediately enclosing element, or from its parent, and so on up the document hierarchy. It is generally good practice to specify xml:lang at the highest appropriate level, noticing that a different default may be needed for the teiHeader from that needed for the associated resource element or elements, and that a single TEI document may contain texts in many languages.
Only attributes with free text values (rare in these guidelines) will be in the scope of xml:lang.
The authoritative list of registered language subtags is maintained by IANA and is available at http://www.iana.org/assignments/language-subtag-registry. For a good general overview of the construction of language tags, see https://www.w3.org/International/articles/language-tags/, and for a practical step-by-step guide, see https://www.w3.org/International/questions/qa-choosing-language-tags.en.php.
The value used must conform with BCP 47. If the value is a private use code (i.e., starts with x- or contains -x-), a language element with a matching value for its ident attribute should be supplied in the TEI header to document this value. Such documentation may also optionally be supplied for non-private-use codes, though these must remain consistent with their Internet Engineering Task Force definitions.
Schematron

<sch:pattern>
   
<sch:rule context="*[@xml:id]">
      
<sch:let name="allIds" value="//*[@xml:id]/@xml:id"/>
      
<sch:let name="myId" value="@xml:id"/>
      
<sch:assert test="count($allIds[. = $myId]) = 1">ERROR: Duplicate id found<sch:value-of select="$myId"/>
      
</sch:assert>
   
</sch:rule>
</sch:pattern>
Source Github

<classSpec rend="change" module="tei" xml:id="GLOBAL" type="atts" ident="att.global">
   
<desc>provides attributes common to all elements in the TEI encoding scheme.</desc>
   
<classes>
      
<memberOf key="lim.att.global.fragmentable"/>
      
<memberOf key="att.global.rendition"/>
      
<memberOf key="att.global.source"/>
   
</classes>
   
<attList>
      
<attDef ident="xml:id" usage="opt">
         
<gloss>identifier</gloss>
         
<desc>provides a unique identifier for the element bearing the attribute.</desc>
         
<datatype>
            
<dataRef name="ID"/>
         
</datatype>
      
</attDef>
      
<attDef ident="n" usage="opt">
         
<gloss>number</gloss>
         
<desc>gives a number (or other label) for an element, which is not necessarily unique within
    the document.
</desc>
         
<datatype maxOccurs="1">
            
<dataRef key="teidata.text"/>
         
</datatype>
      
</attDef>
      
<attDef ident="xml:lang" usage="opt">
         
<gloss>language</gloss>
         
<desc>indicates the language of the element content using a <soCalled>tag</soCalled> generated
    according to 
<ref target="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">BCP 47</ref>.</desc>
         
<datatype>
            
<dataRef key="teidata.language"/>
         
</datatype>
      
</attDef>
   
</attList>
</classSpec>