22 Documentation Elements

This chapter describes a module which may be used for the documentation of the XML elements and element classes which make up any markup scheme, in particular that described by the TEI Guidelines, and also for the automatic generation of schemas or DTDs conforming to that documentation. It should be used also by those wishing to customize or modify these Guidelines in a conformant manner, as further described in chapters 23.3 Personalization and Customization and 23.4 Conformance and may also be useful in the documentation of any other comparable encoding scheme, even though it contains some aspects which are specific to the TEI and may not be generally applicable.

An overview of the kind of processing environment envisaged for the module described by this chapter may be helpful. In the remainder of this chapter we refer to software which provides such a processing environment as an ODD processor.87 Like any other piece of XML software, an ODD processor may be instantiated in many ways: the current system uses a number of XSLT stylesheets which are freely available from the TEI, but this specification makes no particular assumptions about the tools which will be used to provide an ODD processing environment.

As the name suggests, an ODD processor uses a single XML document to generate multiple outputs. These outputs will include:

The input required to generate these outputs consists of running prose, and special purpose elements documenting the components (elements, classes, etc.) which are to be declared in the chosen schema language. All of this input is encoded in XML using elements defined in this chapter. In order to support more than one schema language, these elements constitute a comparatively high-level model which can then be mapped by an ODD processor to the specific constructs appropriate for the schema language in use. Although some modern schema languages such as RELAX NG or W3C Schema natively support self-documentary features of this kind, we have chosen to retain the ODD model, if only for reasons of compatibility with earlier versions of these Guidelines. For reasons of backwards compatibility, the ISO standard XML schema language RELAX NG (http://www.relaxng.org) may be used as a means of declaring content models and datatypes, but it is also possible to express content models using natively TEI XML constructs. We also use the ISO Schematron language to define additional constraints beyond those expressed in the content model, as further discussed in 22.4.4.3 Additional Constraints below.

In the TEI system, a schema is built by combining element and attribute declarations, more or less as required. Each element is documented by an appropriate specification element and has an identifier unique across the whole TEI scheme. For convenience, these specifications are grouped into a number of discrete modules, which can also be combined more or less as required. Each major chapter of these Guidelines defines a distinct module. Each module declares a number of elements specific to that module, and may also populate particular classes. All classes are available globally, irrespective of the module in which they are declared; particular modules extend the meaning of a class by adding elements or attributes to it. Wherever possible, element content models are defined in terms of classes rather than in terms of specific elements. Modules can also declare particular patterns, which act as short-cuts for commonly used content models or class references.

In the present chapter, we discuss the components needed to support this system. In addition, section 22.1 Phrase Level Documentary Elements discusses some general purpose elements which may be useful in any kind of technical documentation, wherever there is need to talk about technical features of an XML encoding such as element names and attributes. Section 22.2 Modules and Schemas discusses the elements which are used to document XML modules and their high-level components. Section 22.3 Specification Elements discusses the elements which document XML elements and their attributes, element classes, and generic patterns or macros. Finally, section 22.8 Module for Documentation Elements provides a summary overview of the elements provided by this module.

22.1 Phrase Level Documentary Elements

22.1.1 Phrase Level Terms

In any kind of technical documentation, the following phrase-level elements may be found useful for marking up strings of text which need to be distinguished from the running text because they come from some formal language:

  • code プログラミング言語のような形式言語のコードを示す.
    lang(formal language) 当該コードの形式言語名を示す.
  • ident (identifier) 形式言語にあるオブジェクトの識別子または名前を示す.

Like other phrase-level elements used to indicate the semantics of a typographically distinct string, these are members of the model.emphLike class. They are available anywhere that running prose is permitted when the module defined by this chapter is included in a schema.

The code and ident elements are intended for use when citing brief passages in some formal language such as a programming language, as in the following example:
<p>If the variable <ident>z</ident> has a value of zero, a statement such as
<code>x=y/z</code> will usually cause a fatal error.</p>

If the cited phrase is a mathematical or chemical formula, the more specific formula element defined by the figures module (14.2 Formulæ and Mathematical Expressions) may be more appropriate.

A further group of similar phrase-level elements is also defined for the special case of representing parts of an XML document:

  • att (attribute) 属性の名前を示す.
  • gi (element name) 要素の名前(共通識別子)を含む.
  • tag 完全な開始タグ,終了タグのテキストを示す.属性規定はとることも可能だ が,タグ開始区切子,タグ終了区切子は含まない.
  • val (value) 属性値をひとつ示す.

These elements constitute the model.phrase.xml class, which is also a subclass of model.phrase. They are also available anywhere that running prose is permitted when the module defined by this chapter is included in a schema.

As an example of the recommended use of these elements, we quote from an imaginary TEI working paper:
<p>The <gi>gi</gi> element is
used to tag element names when they appear in the text; the <gi>tag</gi> element however
is used to show how a tag as such might appear. So one might talk of an occurrence of
the <gi>blort</gi> element which had been tagged <tag>blort type='runcible'</tag>. The
<att>type</att> attribute may take any name token as value; the default value is
<val>spqr</val>, in memory of its creator.</p>

Within technical documentation, it is also often necessary to provide more extended examples of usage or to present passages of markup for discussion. The following special elements are provided for these purposes:

  • eg (example) 例を示す.
  • egXML (example of XML) 要素や属性の使用例を示す,整形式XMLデータによる用例をひとつ含む.要 素egXMLが当該用例の根要素になる.

Like the code element, the egXML element is used to mark strings of formal code, or passages of XML markup. The eg element may be used to enclose any kind of example, which will typically be rendered as a distinct block, possibly using particular formatting conventions, when the document is processed. It is a specialized form of the more general q element provided by the TEI core module. In documents containing examples of XML markup, the egXML element should be used for preference, as further discussed below in 22.4.2 Exemplification of Components, since the content of this element can be checked for well-formedness.

These elements are added to the class model.egLike when this module is included in a schema. That class is a part of the general model.inter class, thus permitting eg or egXML elements to appear either within or between paragraph-like elements.

22.1.2 Element and Attribute Descriptions

Within the body of a document using this module, the following elements may be used to reference parts of the specification elements discussed in section 22.3 Specification Elements, in particular the brief prose descriptions these provide for elements and attributes.

  • specList (specification list) 解説のリストが,散文形式の解説文中に挿入される場所を示す.
  • specDesc/ (specification description) 特定された要素またはクラスの解説は,文書中のこの場所にあるべきである ことを示す.
    atts(attributes) 解説が付加的に表される属性名を示す.
TEI practice recommends that a specList listing the elements under discussion introduce each subsection of a module's documentation. The source for the present section, for example, begins as follows:
<div>
 <head>Element and Attribute Descriptions</head>
 <p>Within the body of a document using this module, the following elements…
 <specList>
   <specDesc key="specList"/>
   <specDesc key="specDescatts="atts"/>
  </specList>
 </p>
 <p>TEI practice recommends that a <gi>specList</gi> listing the elements… </p>
<!-- ... -->
</div>

When formatting the ptr element in this example, an ODD processor might simply generate the section number and title of the section referred to, perhaps additionally inserting a link to the section. In a similar way, when processing the specDesc elements, an ODD processor may recover relevant details of the elements being specified (specList and specDesc in this case) from their associated declaration elements: typically, the details recovered will include a brief description of the element and its attributes. These, and other data, will be stored in a specification element elsewhere within the current document, or they may be supplied by the ODD processor in some other way, for example from a database. For this reason, the link to the required specification element is always made using a TEI-defined key rather than an XML IDREF value. The ODD processor uses this key as a means of accessing the specification element required. There is no requirement that this be performed using the XML ID/IDREF mechanism, but there is an assumption that the identifier be unique.

A specDesc generates in the documentation the identifier, and also the contents of the desc child of whatever specification element is indicated by its key attribute, as in the example above. Documentation for any attributes specified by the atts attribute will also be generated as an associated attribute list.

22.2 Modules and Schemas

As mentioned above, the primary purpose of this module is to facilitate the documentation and creation of an XML schema derived from the TEI Guidelines. The following elements are provided for this purpose:

  • schemaSpec (schema specification) TEI準拠のスキーマや文書を示す.
  • moduleSpec (module specification) いちモジュールの構造,内容,目的を記録する.例えば,外部から名前で参 照可能な宣言集合などである.
  • moduleRef (module reference) スキーマに組み入れられるモジュールを参照する.
    includesupplies a list of the elements which are to be copied from the specified module into the schema being defined.
    exceptsupplies a list of the elements which are not to be copied from the specified module into the schema being defined.
  • specGrp (specification group) 当該モジュール中にある規定をまとめる.
  • specGrpRef/ (reference to a specification group) 要素specGrpにより含まれる宣言が,この場所に挿入されるべきこ とを示す.
  • attRef/ (attribute pointer) 1つまたは複数の属性の定義の場所を示す.
  • elementRef/ points to the specification for some element which is to be included in a schema

A module is a convenient way of grouping together element and other declarations, and of associating an externally-visible name with the resulting group. A specification group performs essentially the same function, but the resulting group is not accessible outside the scope of the ODD document in which it is defined, whereas a module can be accessed by name from any TEI schema specification. Elements, and their attributes, element classes, and patterns are all individually documented using further elements described in section 22.3 Specification Elements below; part of that specification includes the name of the module to which the component belongs.

An ODD processor generating XML DTD or schema fragments from a document marked up according to the recommendations of this chapter will generate such fragments for each moduleSpec element found. For example, the chapter documenting the TEI module for names and dates contains a module specification like the following:
<moduleSpec ident="namesdates">
 <altIdent type="FPI">Names and Dates</altIdent>
 <desc>Additional elements for names and dates</desc>
</moduleSpec>
together with specifications for all the elements, classes, and patterns which make up that module, expressed using elementSpec, classSpec, or macroSpec elements as appropriate. (These elements are discussed in section 22.3 Specification Elements below.) Each of those specifications carries a module attribute, the value of which is namesdates. An ODD processor encountering the moduleSpec element above can thus generate a schema fragment for the TEI namesdates module that includes declarations for all the elements (etc.) which reference it.

In most realistic applications, it will be desirable to combine more than one module together to form a complete schema. A schema consists of references to one or more modules or specification groups, and may also contain explicit declarations or redeclarations of elements (see further 22.5 Building a Schema). Any combination of modules can be used to create a schema 88

A schema can combine references to TEI modules with references to other (non-TEI) modules using different namespaces, for example to include mathematical markup expressed using MathML in a TEI document. By default, the effect of combining modules is to allow all of the components declared by the constituent modules to coexist (where this is syntactically possible: where it is not—for example, because of name clashes—a schema cannot be generated). It is also possible to over-ride declarations contained by a module, as further discussed in section 22.5 Building a Schema

It is often convenient to describe and operate on sets of declarations smaller than the whole, and to document them in a specific order: such collections are called specGrps (specification groups). Individual specGrp elements are identified using the global xml:id attribute, and may then be referenced from any point in an ODD document using the specGrpRef element. This is useful if, for example, it is desired to describe particular groups of elements in a specific sequence. Note however that the order in which element declarations appear within the schema code generated from an ODD file element is not in general affected by the order of declarations within a specGrp.

An ODD processor will generate a piece of schema code corresponding with the declarations contained by a specGrp element in the documentation being output, and a cross-reference to such a piece of schema code when processing a specGrpRef. For example, if the input text reads
<p>This
module contains three red elements: <specGrp xml:id="RED">
  <elementSpec ident="beetroot">
<!-- ... -->
  </elementSpec>
  <elementSpec ident="east">
<!-- ... -->
  </elementSpec>
  <elementSpec ident="rose">
<!-- ... -->
  </elementSpec>
 </specGrp> and two blue ones: <specGrp xml:id="BLUE">
  <elementSpec ident="sky">
<!-- ... -->
  </elementSpec>
  <elementSpec ident="bayou">
<!-- ... -->
  </elementSpec>
 </specGrp>
</p>
then the output documentation will replace the two specGrp elements above with a representation of the schema code declaring the elements <beetroot>, <east>, and <rose> and that declaring the elements <sky> and <bayou> respectively. Similarly, if the input text contains elsewhere a passage such as
<div>
 <head>An overview of the imaginary module</head>
 <p>The imaginary module contains declarations for coloured things: <specGrpRef target="#RED"/>
  <specGrpRef target="#BLUE"/>
 </p>
</div>
then the specGrpRef elements may be replaced by an appropriate piece of reference text such as ‘The RED elements were declared in section 4.2 above’, or even by a copy of the relevant declarations. As stated above, the order of declarations within the imaginary module described above will not be affected in any way. Indeed, it is possible that the imaginary module will contain declarations not present in any specification group, or that the specification groups will refer to elements that come from different modules. Specification groups are always local to the document in which they are defined, and cannot be referenced externally (unlike modules).

22.3 Specification Elements

The following elements are used to declare elements, classes, and patterns:

  • elementSpec (element specification) 構造,内容,その要素の目的などを示す.
  • classSpec (class specification) TEI要素クラスにおける参照情報を示す.内容モデルに出現する要素のまと まり,共通する属性のまとまり,またはその両方.
    generateモデルクラスのインスタンスとしてある選択肢を示す.デフォルトでは, あらゆるものが可能である.
  • macroSpec (macro specification) パタンの機能や実装を解説する.

Unlike most elements in the TEI scheme, each of these ‘specification elements’ has a fairly rigid internal structure consisting of a large number of child elements which are always presented in the same order. Furthermore, since these elements all describe markup objects in broadly similar ways, they have several child elements in common. In the remainder of this chapter, we discuss first the elements which are common to all the specification elements, and then those which are specific to a particular type.

Specification elements may appear at any point in an ODD document, both between and within paragraphs as well as inside a specGrp element, but the specification element for any particular component may only appear once (except in the case where a modification is being defined; see further 22.5 Building a Schema). The order in which they appear will not affect the order in which they are presented within any schema module generated from the document. In documentation mode, however, an ODD processor will output the schema declarations corresponding with a specification element at the point in the text where they are encountered, provided that they are contained by a specGrp element, as discussed in the previous section. An ODD processor will also associate all declarations found with the nominated module, thus including them within the schema code generated for that module, and it will also generate a full reference description for the object concerned in a catalogue of markup objects. These latter two actions always occur irrespective of whether or not the declaration is included in a specGrp.

22.4 Common Elements

This section discusses the child elements common to all of the specification elements; some of these are defined in the core module (3.3.4 Terms, Glosses, Equivalents, and Descriptions). These child elements are used to specify the naming, description, exemplification, and classification of the specification elements.

22.4.1 Description of Components

  • gloss 語句の説明や定義を示す.
  • desc 当該要素,属性,属性値を採用した目的の簡単な解説を示す.
  • equiv/ (equivalent) 親要素と同等とされる構成要素を,相互参照または外部リンクで示す.
    uri(uniform resource identifier) 外部識別子によって親要素の意義を表す.
    filter当該要素を標準的XMLデータに変形する外部スクリプトへの参照を示す.
    name親要素の意義を表す.
  • altIdent (alternate identifier) 特定言語において,XMLの要素,クラス,属性などで推奨される名前を示す.
  • listRef (list of references) 場所への参照のリストを示す.当該文書中でも外部文書でもよい.
  • remarks 要素,属性,クラス,エンティティに関する,まだ文書化されていない解説 や論議を示す.
The gloss element may be used to provide a brief explanation for the name of the object if this is not self-explanatory. For example, the specification for the element ab used to mark arbitrary blocks of text begins as follows:
<elementSpec module="linkingident="ab">
 <gloss>anonymous block</gloss>
<!--... -->
</elementSpec>
A gloss may also be supplied for an attribute name or an attribute value in similar circumstances:
<valList type="open">
 <valItem ident="susp">
  <gloss>suspension</gloss>
  <desc>the abbreviation provides the first letter(s) of the word or phrase, omitting
     the remainder.</desc>
 </valItem>
 <valItem ident="contr">
  <gloss>contraction</gloss>
  <desc>the abbreviation omits some letter(s) in the middle.</desc>
 </valItem>
<!--...-->
</valList>

Note that the gloss element is needed to explain the significance of the identifier for an item only when this is not apparent, for example because it is abbreviated, as in the above example. It should not be used to provide a full description of the intended meaning (this is the function of the desc element), nor to comment on equivalent values in other schemes (this is the purpose of the equiv element), nor to provide alternative versions of the ident attribute value in other languages (this is the purpose of the altIdent element).

The contents of the desc element provide a brief characterization of the intended function of the object being documented in a form that permits its quotation out of context, as in the following example:
<elementSpec module="coreident="foreign">
<!--... -->
 <desc xml:lang="en"
  versionDate="2007-07-21">
identifies a word or phrase as belonging to
   some language other than that of the surrounding text. </desc>
<!--... -->
</elementSpec>
By convention, a desc element begins with a verb such as contains, indicates, specifies, etc. and contains a single clause.

Where specifications are supplied in multiple languages, the elements gloss and desc may be repeated as often as needed. Each such description or gloss should carry both an xml:lang and a versionDate attribute to indicate the language used and the date on which the translated text was last checked against its source.

The equiv element is used to document equivalencies between the concept represented by this object and the same concept as described in other schemes or ontologies. The uri attribute is used to supply a pointer to some location where such external concepts are defined. For example, to indicate that the TEI death element corresponds to the concept defined by the CIDOC CRM category E69, the declaration for the former might begin as follows:
<elementSpec module="namesdates"
 ident="death">

 <equiv name="E69"
  uri="http://cidoc.ics.forth.gr/"/>

 <desc>
<!--... -->
 </desc>
</elementSpec>
The equiv element may also be used to map newly-defined elements onto existing constructs in the TEI, using the filter and name attributes to point to an implementation of the mapping. This is useful when a TEI customization (see 23.3 Personalization and Customization) defines ‘shortcuts’ for convenience of data entry or markup readability. For example, suppose that in some TEI customization an element <bo> has been defined which is conceptually equivalent to the standard markup construct <hi rend='bold'>. The following declarations would additionally indicate that instances of the <bo> element can be converted to canonical TEI by obtaining a filter from the URI specified, and running the procedure with the name bold. The mimeType attribute specifies the language (in this case XSL) in which the filter is written:
<elementSpec ident="bo"
 ns="http://www.example.com/ns/notTEI">

 <equiv filter="http://www.example.com/equiv-filter.xsl"
  mimeType="text/xslname="bold"/>

 <gloss>bold</gloss>
 <desc>contains a sequence of characters rendered in a bold face.</desc>
<!-- ... -->
</elementSpec>
The altIdent element is used to provide an alternative name for an object, for example using a different natural language. Thus, the following might be used to indicate that the abbr element should be identified using the German word Abkürzung:
<elementSpec ident="abbrmode="change">
 <altIdent xml:lang="de">Abkürzung</altIdent>
<!--...-->
</elementSpec>
In the same way, the following specification for the graphic element indicates that the attribute url may also be referred to using the alternate identifier href:
<elementSpec ident="graphicmode="change">
 <attList>
  <attDef mode="changeident="url">
   <altIdent>href</altIdent>
  </attDef>
<!-- .... -->
 </attList>
</elementSpec>

By default, the altIdent of a component is identical to the value of its ident attribute.

The remarks element contains any additional commentary about how the item concerned may be used, details of implementation-related issues, suggestions for other ways of treating related information etc., as in the following example:
<elementSpec module="coreident="foreign">
<!--... -->
 <remarks>
  <p>This element is intended for use only where no other element is available to mark
     the phrase or words concerned. The global <att>xml:lang</att> attribute should be
     used in preference to this element where it is intended to mark the language of the
     whole of some text element.</p>
  <p>The <gi>distinct</gi> element may be used to identify phrases belonging to
     sublanguages or registers not generally regarded as true languages.</p>
 </remarks>
<!--... -->
</elementSpec>
A specification element will usually conclude with a list of references, each tagged using the standard ptr element, and grouped together into a listRef element: in the case of the foreign element discussed above, the list is as follows:
<listRef>
 <ptr target="#COHQHF"/>
</listRef>
where the value COHQF is the identifier of the section in the Guidelines where this element is fully documented.

22.4.2 Exemplification of Components

  • exemplum 要素の使用例をひとつ示す.段落単位の解説を伴うかもしれない.
  • eg (example) 例を示す.
  • egXML (example of XML) 要素や属性の使用例を示す,整形式XMLデータによる用例をひとつ含む.要 素egXMLが当該用例の根要素になる.
    validindicates the intended validity of the example with respect to a schema.
    source [att.source]provides a pointer to the bibliographical source from which a quotation or citation is drawn.

The exemplum element is used to combine a single illustrative example with an optional paragraph of commentary following or preceding it. The illustrative example itself may be marked up using either the eg or the egXML element.

The source attribute may be used on either element to indicate the source from which an example is taken, typically by means of a pointer to an entry in an associated bibliography, as in the following example:
  <exemplum versionDate="2008-04-06" xml:lang="fr">   <p>L'element <gi>foreign</gi> s'applique également aux termes considerés étrangers.</p>     <egXML xmlns="http://www.tei-c.org/ns/Examples" source="#fr-ex-Queneau_Journ">       <p>Pendant ce temps-là, dans le bureau du rez- de-chaussée, les secrétaires faisaient du         <foreign xml:lang="en">hulla-hoop</foreign>.</p>     </egXML>   </exemplum>

When, as here, an example contains valid XML markup, the egXML element should be used. In such a case, it will clearly be necessary to distinguish the markup within the example from the markup of the document itself. In an XML environment, this is easily done by using a different name space for the content of the egXML element. For example:

<p>The <gi>term</gi> element may be used 
to mark any technical term, thus:
<egXML xmlns="http://www.tei-c.org/ns/Examples">
  This <term>recursion</term> is 
  giving me a headache.</egXML></p>

Alternatively, the XML tagging within an example may be ‘escaped’, either by using entity references to represent the opening angle bracket, or by wrapping the whole example in a CDATA marked section:

<p>The <gi>term</gi> element may be used 
to mark any technical term, thus:
<egXML xmlns="http://www.tei-c.org/ns/Examples">
  This &lt;term&gt;recursion&lt;/term&gt; is 
  giving me a headache.</egXML></p>

or, equivalently:

<p>The <gi>term</gi> element may be used 
to mark any technical term, thus:
<egXML xmlns="http://www.tei-c.org/ns/Examples"><![CDATA[
  This <term>recursion</term> is 
  giving me a headache.]]></egXML></p>

However, escaping the markup in this way will make it impossible to validate, and should therefore generally be avoided.

If the XML contained in an example is not well-formed then it must either be enclosed in a CDATA marked section, or ‘escaped’ as above: this applies whether the eg or egXML is used. The valid attribute on egXML may be used to indicate the XML validity of the example with respect to some schema, as being valid, invalid, or feasibly valid.

The egXML element should not be used to tag non-XML examples: the general purpose eg or q elements should be used for such purposes.

22.4.3 Classification of Components

In the TEI scheme elements are assigned to one or more classes, which may themselves have subclasses. The following elements are used to indicate class membership:

  • classes 当該文書化されている要素やクラスの構成要素や下位クラスを示す.
  • memberOf 親要素や親クラスを示す.
    key当該要素またはクラスが下位要素・下位クラスとなっているクラスの識 別子を示す.

The classes element appears within either the elementSpec or classSpec element. It specifies the classes of which the element or class concerned is a member by means of one or more memberOf child elements. Each such element references a class by means of its key attribute. Classes themselves are defined by the classSpec element described in section 22.4.6 Element Classes below.

For example, to show that the element gi is a member of the class model.phrase.xml, the elementSpec which documents this element contains the following classes element:
<classes>
 <memberOf key="model.phrase.xml"/>
</classes>

22.4.4 Element Specifications

The elementSpec element is used to document an element type, together with its associated attributes. In addition to the elements listed above, it may contain the following subcomponents:

  • content (content model) 当該スキーマの宣言を示す.
    autoPrefixcontrols whether or not pattern names generated in the corresponding Relax NG schema source are automatically prefixed to avoid potential nameclashes.
  • constraintSpec (constraint on schema) contains a constraint, expressed in some formal syntax, which cannot be expressed in the structural content model
    schemesupplies the name of the language in which the constraints are defined
  • attList 当該要素に関する全ての属性に関する文書を,一連の要素attDef で示す.
    org(organization) リスト中の属性が全て使用できるか(org="group"),またはその1つだけ が使用できるか(org="choice")を示す.
22.4.4.1 Defining Content Models

The element content may have three different kinds of content. It may express a content model directly using the TEI elements discussed in the remainder of this section. Alternatively, it may use a schema language of some kind, as defined by a pattern called macro.schemaPattern, which is provided by the module defined in this chapter. This is discussed in section 22.4.4.2 RELAX NG Content Models below. As a third possibility, the legal content for an element may be exhaustively specified using the valList element, described in 22.4.5 Attribute List Specification below.

The following elements are used to define a content model:

  • textNode indicates the presence of a text node in a content model
  • elementRef/ points to the specification for some element which is to be included in a schema
  • classRef/ points to the specification for an attribute or model class which is to be included in a schema
  • macroRef/ points to the specification for some pattern which is to be included in a schema

In the simplest case, the content element may be empty. This implies that the element being specified is also empty.

An element may contain nothing but strings of Unicode characters. This is indicated by supplying the special element textNode within the content element.

An elementRef provides the name of an element which may appear at a certain point in a content model. A classRef provides the name of a class, members of which may appear at a certain point in content model. A macroRef provides the name of a predefined macro, the expansion of which may be inserted at a certain point in a content model.

These elements are all members of an attribute class which provides attributes that further modify their significance as follows:

  • att.repeatable supplies attributes for the elements which define component parts of a content model.
    minOccurs(minimum number of occurences) indicates the smallest number of times this component may occur.
    maxOccurs(maximum number of occurences) indicates the largest number of times this component may occur.
    contextsupplies an XPath identifying a context within which this component of a content model must be found

Finally, two wrapper elements are provided to indicate whether the components of a content model form a sequence or an alternation:

Here is a simple example:
<content>
 <alternate minOccurs="0"
  maxOccurs="unbounded">

  <classRef key="model.gLike"/>
  <textNode/>
 </alternate>
</content>
This is the content model for the macro macro.xText, which is defined as containing any number (including zero) of elements from the model.gLike class mixed in with text.
Here is a more complex example:
<content>
 <sequence>
  <elementRef key="fileDesc"/>
  <classRef key="model.teiHeaderPart"
   minOccurs="0maxOccurs="unboundedexpand="alternate"/>

  <elementRef key="revisionDesc"
   minOccurs="0"/>

 </sequence>
</content>
This is the content model for the teiHeader element, which is defined as a sequence of components, firstly a mandatory fileDesc, followed by any number (including zero) of elements from the model.teiHeaderPart class, and finally an optional revisionDesc element.
22.4.4.2 RELAX NG Content Models

Alternatively, element content models may be defined using RELAX NG patterns, or by expressions in some other schema language, depending on the value of the macro.schemaPattern pattern.

Here is a very simple example
<content>
 <rng:text/>
</content>
The element within whose specification element this content element appears will have a content model which is expressed in RELAX NG as text, using the RELAX NG namespace. This model will be copied unchanged to the output when RELAX NG schemas are being generated. When an XML DTD is being generated, an equivalent declaration (in this case (#PCDATA)) will be output.
Here is a more complex example:
<content>
 <rng:group>
  <rng:ref name="fileDesc"/>
  <rng:zeroOrMore>
   <rng:ref name="model.teiHeaderPart"/>
  </rng:zeroOrMore>
  <rng:optional>
   <rng:ref name="revisionDesc"/>
  </rng:optional>
 </rng:group>
</content>
This is the content model for the teiHeader element, expressed in the RELAX NG syntax, which again is copied unchanged to the output during schema generation. The equivalent DTD notation generated from this is (fileDesc, (%model.teiHeaderPart;)*, revisionDesc?).

The RELAX NG language does not formally distinguish element names, attribute names, class names, or macro names: all names are patterns which are handled in the same way, as the above example shows. Within the TEI scheme, however, different naming conventions are used to distinguish amongst the objects being named. Unqualified names (fileDesc, revisionDesc) are always element names. Names prefixed with model. or att. (e.g. model.teiHeaderPart and att.typed) are always class names. In DTD language, classes are represented by parameter entities (%model.teiHeaderPart; in the above example); see further 1 The TEI Infrastructure.

The RELAX NG pattern names generated by an ODD processor by default include a special prefix, the default value for which is set using the prefix attribute on schemaSpec. The purpose of this is to ensure that the pattern name generated is uniquely identified as belonging to a particular schema, and thus avoid name clashes. For example, in a RELAX NG schema combining the TEI element ident with another element called ident from some other vocabulary, the former will be defined by a pattern called TEI_ident rather than simply ident. Most of the time, this behaviour is entirely transparent to the user; the one occasion when it is not will be where a content model (expressed using RELAX NG syntax) needs explicitly to reference either the TEI ident or the other one. In such a situation, the autoPrefix attribute on content may be used. For example, suppose that we wish to define a content model for term which permits either a TEI ident or the ident defined by some other vocabulary. A suitable content model would be generated from the following content element:
<content autoPrefix="false">
 <rng:choice>
  <rng:ref name="TEI_ident"/>
  <rng:ref name="ident"/>
 </rng:choice>
</content>
22.4.4.3 Additional Constraints

In addition to the content element, a set of general constraintSpec elements can be used to express rules about the validity of an element. Like some other specification elements, they are identifiable (using the ident attribute) in order that a TEI customization may override, delete or change them individually. Each constraintSpec can be expressed in any notation which is found useful; the notation used must be recorded using the scheme attribute.

Schematron is an ISO standard (ISO/IEC 19757-3:2006) which defines a simple XML vocabulary for a ‘assertion language’, together with a RELAXNG to validate it. The Schematron assertion language provides a powerful way of expressing constraints on the content of any XML document in addition to those provided by other schema languages. Such constraints can be embedded within a TEI schema specification using the methods exemplified in this chapter. An ODD processor will typically process any constraintSpec elements in a TEI specification whose scheme attribute indicates that they are expressed in Schematron to create an ISO-conformant Schematron schema which may be used to validate document instances.

The TEI Guidelines include some additional constraints which are expressed using the ISO Schematron language. A conformant TEI document should respect these constraints, although automatic validation of them may not be possible for all processors. A TEI customization may likewise specify additional constraints using this mechanism. Some examples of what is possible using the Schematron language are given below.

Constraints are generally used to model local rules which may be outside the scope of the target schema language. For example, in earlier versions of these Guidelines several constraints on the usage of the attributes of the TEI element relation were expressed informally as follows: ‘only one of the attributes active and mutual may be supplied; the attribute passive may be supplied only if the attribute active is supplied.’. Few schema language support co-occurence constraints such as the latter. In the current version of the Guidelines, constraint specifications expressed as Schematron rules have been added, as follows:
<constraintSpec ident="reforkeyorname"
 scheme="isoschematron">

 <constraint>
  <s:assert test="@ref or @key or @name">One of the attributes 'name', 'ref' or 'key' must be supplied</s:assert>
 </constraint>
</constraintSpec>
<constraintSpec ident="activemutual"
 scheme="isoschematron">

 <constraint>
  <s:report test="@active and @mutual">Only
     one of the attributes @active and @mutual may be supplied</s:report>
 </constraint>
</constraintSpec>
<constraintSpec ident="activepassive"
 scheme="isoschematron">

 <constraint>
  <s:report test="@passive and not(@active)">the attribute 'passive' may be supplied only if
     the attribute 'active' is supplied</s:report>
 </constraint>
</constraintSpec>
The constraints in the preceding example all related to attributes in the empty namespace, and the schematron rules did not therefore need to define a TEI namespace prefix. The Schematron language <ns> element should be used to do this when a constraint needs to refer to a TEI element, as in the following example, which models the constraint that a TEI div must contain either no subdivisions or at least two of them:
<constraintSpec ident="subclauses"
 scheme="isoschematron">

 <constraint>
  <s:ns prefix="tei"
   uri="http://www.tei-c.org/ns/1.0"/>

  <s:rule context="tei:div">
   <s:assert test="not(tei:div) or count(tei:div)>1">a division must contain at
       least two subdivisions</s:assert></s:rule>
 </constraint>
</constraintSpec>
Schematron rules are also useful where an application needs to enforce rules on attribute values, as in the following examples which check that various types of title are provided :
<constraintSpec ident="introtitle"
 scheme="isoschematron">

 <constraint>
  <s:assert test="tei:fileDesc/tei:titleStmt/tei:title[@type='introductory']"> an introductory
     component of the title is expected </s:assert>
 </constraint>
</constraintSpec>
<constraintSpec ident="maintitle"
 scheme="isoschematron">

 <constraint>
  <s:assert test="tei:fileDesc/tei:titleStmt/tei:title[@type='main']"> a main title must be
     supplied </s:assert>
 </constraint>
</constraintSpec>
As a further example, Schematron may be used to enforce rules applicable to a TEI document which is going to be rendered into accessible HTML, for example to check that some sort of content is available from which the alt attribute of an HTML <img> can be created:
<constraintSpec ident="alt"
 scheme="isoschematron">

 <constraint>
  <s:ns prefix="tei"
   uri="http://www.tei-c.org/ns/1.0"/>

  <s:pattern id="altTags">
   <s:rule context="tei:figure">
    <s:report test="not(tei:figDesc or tei:head)"> You should provide information in a
         figure from which we can construct an alt attribute in HTML </s:report></s:rule></s:pattern>
 </constraint>
</constraintSpec>
Schematron rules can also be used to enforce other HTML accessibility rules about tables; note here the use of a report and an assertion within one pattern:
<constraintSpec ident="tables"
 scheme="isoschematron">

 <constraint>
  <s:ns prefix="tei"
   uri="http://www.tei-c.org/ns/1.0"/>

  <s:pattern id="Tables">
   <s:rule context="tei:table">
    <s:assert test="tei:head">A <table> should have a caption, using a <head>
         element</s:assert>
    <s:report test="parent::tei:body">Do not use tables to lay out the document
         body</s:report></s:rule></s:pattern>
 </constraint>
</constraintSpec>
Constraints can be expressed using any convenient language. The following example uses a pattern matching language called SPITBOL to express the requirement that title and author should be different. Implementing private schemes of this kind will generally be more problematic than simply adopting a widely-deployed system such as ISO Schematron however.
<constraintSpec ident="local"
 scheme="private">

 <constraint> (output = leq(title,author) "title and author cannot be the same")
 </constraint>
</constraintSpec>

22.4.5 Attribute List Specification

The attList element is used to document information about a collection of attributes, either within an elementSpec, or within a classSpec. An attribute list can be organized either as a group of attribute definitions, all of which are understood to be available, or as a choice of attribute definitions, of which only one is understood to be available. An attribute list may thus contain nested attribute lists.

The attribute org is used to indicate whether its child attDef elements are all to be made available, or whether only one of them may be used. For example, the attribute list for the element moduleRef contains a nested attribute list to indicate that either the include or the except attribute may be supplied, but not both:
<attList>
<!-- other attribute definitions here -->
 <attList org="choice">
  <attDef ident="include">
<!-- definition for the include attribute -->
  </attDef>
  <attDef ident="except">
<!-- definition for the except attribute -->
  </attDef>
 </attList>
</attList>

The attDef element is used to document a single attribute, using an appropriate selection from the common elements already mentioned and the following which are specific to attributes:

  • attDef (attribute definition) 1つの属性の定義を示す.
    usage属性または要素の選択性を示す.
  • datatype 属性値の型を,当該スキーマ中のデータ型を参照して示す.
    minOccurs(minimum number of occurences) 属性値としてとる当該データ型の値が出現する最小回数を示す.
    maxOccurs(maximum number of occurences) 当該データ型が属性値として出現する最大回数を示す.
  • defaultVal (default value) 属性の既定値を示す.
  • valDesc (value description) 要素datatypeにある情報に加えて,属性値の意味的・統語的制約 を示す.
  • valList (value list) 可能な属性値を表すひとつ以上の要素valItemを示す.
  • valItem 属性値のひとつを解説する.

The attList within an elementSpec is used to specify only the attributes which are specific to that particular element. Instances of the element may carry other attributes which are declared by the classes of which the element is a member. These extra attributes, which are shared by other elements, or by all elements, are specified by an attList contained within a classSpec element, as described in section 22.4.6 Element Classes below.

22.4.5.1 Datatypes

The datatype element is used to state what kind of value an attribute may have. The TEI defines a number of datatype macros, each with an identifier beginning data., which are used in preference to the datatypes available natively from the target schema, since the facilities provided by different schema languages vary so widely. The available TEI datatypes are described in section 1.4.2 Datatype Macros above.

A TEI schema specification using RELAX NG may choose to define datatypes directly using RELAX NG syntax, for example
<datatype>
 <rng:text/>
</datatype>
permits any string of Unicode characters not containing markup, and is thus the equivalent of CDATA in DTD language.

The RELAX NG language also provides support for a number of more complex cases such as choices or lists. Such usages are permitted by the scheme documented here, but are not recommended when it is desired to remain independent of a particular schema language, since the full generality of one schema language cannot readily be converted to that of another. In the TEI abstract model, datatyping should preferably be carried out either by explicit enumeration of permitted values (using the TEI-specific valList element described below), by reference to an existing datatype macro, or by definition of a new datatype, using the macroSpec element discussed further in section 22.4.7 Pattern Documentation.

The attributes minOccurs and maxOccurs are provided for the case where an attribute may take more than one value of the type specified. The target attribute provided by the att.pointing class for example has the following declaration:
<attDef ident="target">
 <desc versionDate="2010-05-02"
  xml:lang="en">
specifies the destination of the
   reference by supplying one or more URI References</desc>
 <datatype maxOccurs="unbounded">
  <rng:ref name="data.pointer"/>
 </datatype>
</attDef>
indicating that the target attribute may take any number of values, each being of the type defined by the TEI data.pointer macro. As is usual in XML, multiple values for a single attribute are separated by one or more white space characters. Hence, values such as #a #b #c or http://example.org http://www.tei-c.org/index.xml may be supplied.
22.4.5.2 Value Specification
The valDesc element may be used to describe constraints on data content in an informal way: for example
<valDesc>must
point to another <gi>align</gi> element logically preceding this
one.</valDesc>
<valDesc>Values should be Library of
Congress subject headings.</valDesc>
<valDesc>A bookseller's surname, taken
from the list in <title>Pollard and Redgrave</title>
</valDesc>
Constraints expressed in this way are purely documentary; to enforce them, the constraintSpec element described in section 22.4.4 Element Specifications must be used. For example, to specify that an imaginary attribute ageAtDeath must take positive integer values less than 150, the datatype data.numeric might be used in combination with a constraintSpec such as the following:
<attDef ident="age">
 <desc>age in years at death</desc>
 <datatype>data.numeric</datatype>
 <constraintSpec ident="lessThan150"
  scheme="isoschematron">

  <constraint>
   <s:assert test=". < 150"> age at
       death must be a number less than 150 </s:assert>
  </constraint>
 </constraintSpec>
</attDef>
The elements altIdent, equiv, gloss and desc may all be used in the same way as they are elsewhere to describe fully the meaning of a coded value, as in the following example:
<valItem ident="dub">
 <altIdent xml:lang="fr">dou</altIdent>
 <equiv name="unknown"/>
 <gloss>dubious</gloss>
 <desc>used when the application of this element is doubtful or uncertain</desc>
</valItem>
Where all the possible values for an attribute can be enumerated, the datatype data.enumerated should be used, together with a valList element to specify the values and their significance, as in the following example:
<valList type="closed">
 <valItem ident="req">
  <gloss>required</gloss>
 </valItem>
 <valItem ident="rec">
  <gloss>recommended</gloss>
 </valItem>
 <valItem ident="opt">
  <gloss>optional</gloss>
 </valItem>
</valList>
Note the use of the gloss element here to explain the otherwise less than obvious meaning of the codes used for these values. Since this value list specifies that it is of type closed, only the values enumerated are legal, and an ODD processor will typically enforce these constraints in the schema fragment generated.
The valList element can also be used to provide illustrative examples of the kinds of values expected without listing all of them. In such cases the type attribute will have the value open, as in the following example:
<attDef ident="typeusage="opt">
 <desc versionDate="2005-01-14"
  xml:lang="en">
characterizes the movement, for example
   as an entrance or exit.</desc>
 <desc versionDate="2007-12-20"
  xml:lang="ko">
예를 들어 입장 또는 퇴장과 같은, 이동의 특성을 기술한다.</desc>
 <datatype>
  <rng:ref name="data.enumerated"/>
 </datatype>
 <valList type="open">
  <valItem ident="entrance">
   <desc versionDate="2007-06-27"
    xml:lang="en">
character is entering the
       stage.</desc>
   <desc versionDate="2007-12-20"
    xml:lang="ko">
등장인물이 무대에 등장하고 있다.</desc>
  </valItem>
  <valItem ident="exit">
   <desc versionDate="2007-06-27"
    xml:lang="en">
character is exiting the
       stage.</desc>
   <desc versionDate="2007-12-20"
    xml:lang="ko">
등장인물이 무대에서 퇴장하고 있다.</desc>
  </valItem>
  <valItem ident="onStage">
   <desc versionDate="2007-07-04"
    xml:lang="en">
character moves on stage</desc>
   <desc versionDate="2007-12-20"
    xml:lang="ko">
등장인물이 무대에서 이동한다.</desc>
  </valItem>
 </valList>
</attDef>
The datatype will be data.enumerated in either case.

The valList element may also be used (as a child of the content element) to put constraints on the permitted content of an element, as noted at 22.4.4.2 RELAX NG Content Models. This use is not however supported by all schema languages, and is therefore not recommended if support for non-RELAX NG systems is a consideration.

22.4.6 Element Classes

The element classSpec is used to document either an attribute class or a ‘model class’, as defined in section 1.3 The TEI Class System. A corresponding classRef element may be used to select a specific named class from those available.

  • classSpec (class specification) TEI要素クラスにおける参照情報を示す.内容モデルに出現する要素のまと まり,共通する属性のまとまり,またはその両方.
    type当該クラスがモデルクラスか属性クラスかを示す.
  • classRef/ points to the specification for an attribute or model class which is to be included in a schema
  • attList 当該要素に関する全ての属性に関する文書を,一連の要素attDef で示す.
    org(organization) リスト中の属性が全て使用できるか(org="group"),またはその1つだけ が使用できるか(org="choice")を示す.
A model class specification does not list all of its members. Instead, its members declare that they belong to it by means of a classes element contained within the relevant elementSpec. This will contain a memberOf element for each class of which the relevant element is a member, supplying the name of the relevant class. For example, the elementSpec for the element hi contains the following:
<classes>
 <memberOf key="model.hiLike"/>
</classes>
This indicates that the hi element is a member of the class with identifier model.hiLike. The classSpec element that documents this class contains the following declarations:
<classSpec type="model"
 ident="model.hiLike">

 <desc>groups phrase-level elements related to highlighting that have no specific
   semantics </desc>
 <classes>
  <memberOf key="model.highlighted"/>
 </classes>
</classSpec>
which indicate that the class model.hiLike is actually a member (or subclass) of the class model.highlighted.

The function of a model class declaration is to provide another way of referring to a group of elements. It does not confer any other properties on the elements which constitute its membership.

The attribute type is used to distinguish between ‘model’ and ‘attribute’ classes. In the case of attribute classes, the attributes provided by membership in the class are documented by an attList element contained within the classSpec. In the case of model classes, no further information is needed to define the class beyond its description, its identifier, and optionally any classes of which it is a member.

When a model class is referenced in the content model of an element (i.e. in the content of an elementSpec), its meaning will depend on the name used to reference the class.

If the reference simply takes the form of the class name, it is interpreted to mean an alternated list of all the current members of the class. For example, suppose that the members of the class model.hiLike are elements hi, <it>, and <bo>. Then a content model such as
<content>
 <rng:zeroOrMore>
  <rng:ref name="model.hiLike"/>
 </rng:zeroOrMore>
</content>
would be equivalent to the explicit content model:
<content>
 <rng:zeroOrMore>
  <rng:choice>
   <rng:ref name="hi"/>
   <rng:ref name="it"/>
   <rng:ref name="bo"/>
  </rng:choice>
 </rng:zeroOrMore>
</content>
(or, to use RELAX NG compact syntax, (hi|it|bo)*). However, a content model referencing the class as model.hiLike_sequence would be equivalent to the following explicit content model:
<content>
 <rng:zeroOrMore>
  <rng:ref name="hi"/>
  <rng:ref name="it"/>
  <rng:ref name="bo"/>
 </rng:zeroOrMore>
</content>
(or, in RELAX NG compact syntax, (hi,it,bo)*).

The following suffixes, appended with an underscore, can be given to a class name when it is referenced in a content model:

alternation
members of the class are alternatives
sequence
members of the class are to be provided in sequence
sequenceOptional
members of the class may be provided, in sequence, but are optional
sequenceOptionalRepeatable
members of the class may be provided one or more times, in sequence, but are optional
sequenceRepeatable
members of the class must be provided one or more times, in sequence
Thus a reference to model.hiLike_sequenceOptional in a content model would be equivalent to:
<rng:zeroOrMore>
 <rng:optional>
  <rng:ref name="hi"/>
 </rng:optional>
 <rng:optional>
  <rng:ref name="it"/>
 </rng:optional>
 <rng:optional>
  <rng:ref name="bo"/>
 </rng:optional>
</rng:zeroOrMore>
A reference to model.hiLike_sequenceRepeatable would however be equivalent to:
<rng:zeroOrMore>
 <rng:oneOrMore>
  <rng:ref name="hi"/>
 </rng:oneOrMore>
 <rng:oneOrMore>
  <rng:ref name="it"/>
 </rng:oneOrMore>
 <rng:oneOrMore>
  <rng:ref name="bo"/>
 </rng:oneOrMore>
</rng:zeroOrMore>
and a reference to model.hiLike_sequenceOptionalRepeatable would be equivalent to:
<rng:zeroOrMore>
 <rng:zeroOrMore>
  <rng:ref name="hi"/>
 </rng:zeroOrMore>
 <rng:zeroOrMore>
  <rng:ref name="it"/>
 </rng:zeroOrMore>
 <rng:zeroOrMore>
  <rng:ref name="bo"/>
 </rng:zeroOrMore>
</rng:zeroOrMore>

The ‘sequence’ in which members of a class appear in a content model when one of the sequence options is used is that in which the elements are declared.

In principle, all these possibilities are available to any element making reference to any class. The classSpec element defining the class may however limit the possibilities by means of its generate attribute, which can be used to say that this particular model may only be referenced in a content model with the suffixes it specifies. For example, if the classSpec for model.hiLike took the form <classSpec ident="model.hiLike" generate="sequence sequenceOptional"> then a content model referring to (say) model.hiLike_sequenceRepeatable would be regarded as invalid by an ODD processor.

An attribute class (a classSpec of type atts) contains an attList element which lists the attributes that all the members of that class inherit from it. For example, the class att.interpLike defines a small set of attributes common to all elements which are members of that class: those attributes are listed by the attList element contained by the classSpec for att.interpLike. When processing the documentation elements for elements which are members of that class, an ODD processor is required to extend the attList (or equivalent) for such elements to include any attributes defined by the classSpec elements concerned. There is a single global attribute class, att.global, to which some modules contribute additional attributes when they are included in a schema.

22.4.7 Pattern Documentation

The macroSpec element is used to declare and document predefined strings or patterns not otherwise documented by the elements described in this chapter. A corresponding macroRef element may be used to select a specific named pattern from those available. Patterns are used as a shorthand chiefly to describe common content models and datatypes, but may be used for any purpose. The following elements are used to represent patterns:

  • macroSpec (macro specification) パタンの機能や実装を解説する.
    typeODDソフトウェアがXML DTDによるモジュールを生成する際,どの種類の エンティティが生成されるかを示す.
  • macroRef/ points to the specification for some pattern which is to be included in a schema
    keythe identifier used for the required pattern within the source indicated.
  • remarks 要素,属性,クラス,エンティティに関する,まだ文書化されていない解説 や論議を示す.

22.5 Building a Schema

The specification elements, and some of their children, are all members of the att.identified class, from which they inherit the following attributes:

  • att.identified 属性keyで参照されている要素に付与する属性を示す.
    ident当該要素を参照する識別子を示す.
    predeclare当該オブジェクトが,TEI基盤モジュー ルで事前に宣言されるべきかどうかを示す.
    module当該オブジェクトが定義されているモジュール名を示す.

This attribute class is a subclass of the att.combinable class from which it (and some other elements) inherits the following attribute:

  • att.combinable provides attributes indicating how multiple references to the same object in a schema should be combined
    mode当該宣言が親要素に与える影響を示す.

This attribute class, in turn, is a subclass of the att.deprecated class, from which it inherits the following attribute:

  • att.deprecated provides attributes indicating how a deprecated feature will be treated in future releases.
    validUntilprovides a date before which the construct being defined will not be removed.

The validUntil attribute may be used to signal an intent to remove a construct from future versions of the schema being specified.

The elementSpec, attDef and schemaSpec specification elements also have an attribute which determines which namespace to which the object being created will belong. In the case of schemaSpec, this namespace is inherited by all the elements created in the schema, unless they have their own ns.

  • att.namespaceable provides an attribute indicating the target namespace for an object being created

These attributes are used by an ODD processor to determine how declarations are to be combined to form a schema or DTD, as further discussed in this section.

As noted above, a TEI schema is defined by a schemaSpec element containing an arbitrary mixture of explicit declarations for objects (i.e. elements, classes, patterns, or macro specifications) and references to other objects containing such declarations (i.e. references to specification groups, or to modules). A major purpose of this mechanism is to simplify the process of defining user customizations, by providing a formal method for the user to combine new declarations with existing ones, or to modify particular parts of existing declarations.

In the simplest case, a user-defined schema might simply combine all the declarations from two nominated modules:
<schemaSpec ident="example">
 <moduleRef key="core"/>
 <moduleRef key="linking"/>
</schemaSpec>
An ODD processor, given such a document, should combine the declarations which belong to the named modules, and deliver the result as a schema of the requested type. It may also generate documentation for the elements declared by those modules. No source is specified for the modules, and the schema will therefore combine the declarations found in the most recent release version of the TEI Guidelines known to the ODD processor in use.

The value specified for the source attribute, when it is supplied as a URL, specifies any convenient location from which the relevant ODD files may be obtained. For the current release of the TEI Guidelines, a URL in the form http://www.tei-c.org/Vault/P5/x.y.z/xml/tei/odd/p5subset.xml may be used, where x.y.z represents the P5 version number, e.g. 1.3.0. Alternatively, if the ODD files are locally installed, it may be more convenient to supply a value such as ../ODDs/p5subset.xml".

The value for the source attribute may be any form of URI. A set of TEI-conformant specifications in a form directly usable by an ODD processor must be available at the location indicated. When no source value is supplied, an ODD processor may either raise an error or assume that the location of the current release of the TEI Guidelines is intended.

If the source is specified in the form of a private URI, the form recommended is aaa:x.y.z, where aaa is a prefix indicating the markup language in use, and x.y.z indicates the version number. For example, tei:1.2.1 should be used to reference release 1.2.1 of the current TEI Guidelines. When such a URI is used, it will usually be necessary to translate it before such a file can be used in blind interchange.

The effect of a moduleRef element is to include in the schema all declarations provided by that module. This may be modified by means of the attributes include and except which allow the encoder to supply an explicit lists of elements from the stated module which are to be included or excluded respectively. For example:
<schemaSpec ident="example">
 <moduleRef key="core"
  except="add del orig reg"/>

 <moduleRef key="linking"
  include="linkGroup link"/>

</schemaSpec>
The schema specified here will include all the elements supplied by the core module except for add, del, orig, and reg. It will also include only the <linkGroup> and link elements from the linking module.
Alternatively, the element elementRef may be used to indicate explicitly which elements are to be included in a schema. The same effect as the preceding example might thus be achieved by the following:
<schemaSpec ident="example">
 <moduleRef key="core"
  except="add del orig reg"/>

 <elementRef key="linkGroup"/>
 <elementRef key="link"/>
</schemaSpec>
Note that in this last case, there is no need to specify the name of the module from which the two element declarations are to be found; in the TEI scheme, element names are unique across all modules. The module is simply a convenient way of grouping together a number of related declarations.
A schema may also include declarations for new elements, as in the following example:
<schemaSpec ident="example">
 <moduleRef key="teiheader"/>
 <moduleRef key="verse"/>
 <elementSpec ident="soundClip">
  <classes>
   <memberOf key="model.pPart.data"/>
  </classes>
 </elementSpec>
</schemaSpec>
A declaration for the element <soundClip>, which is not defined in the TEI scheme, will be added to the output schema. This element will also be added to the existing TEI class model.pPart.data, and will thus be available in TEI conformant documents.
A schema might also include re-declarations of existing elements, as in the following example:
<schemaSpec ident="example">
 <moduleRef key="teiheader"/>
 <moduleRef key="teistructure"/>
 <elementSpec ident="headmode="change">
  <content>
   <rng:ref name="macro.xtext"/>
  </content>
 </elementSpec>
</schemaSpec>
The effect of this is to redefine the content model for the element head as plain text, by over-riding the content child of the selected elementSpec. The attribute specification mode="change" has the effect of over-riding only those children elements of the elementSpec which appear both in the original specification and in the new specification supplied above: content in this example. Note that if the value for mode were replace, the effect would be to replace all children elements of the original specification with the the children elements of the new specification, and thus (in this example) to delete all of them except content.

A schema may not contain more than two declarations for any given component. The value of the mode attribute is used to determine exactly how the second declaration (and its constituents) should be combined with the first. The following table summarizes how a processor should resolve duplicate declarations; the term identifiable refers to those elements which can have a mode attribute:

mode valueexisting declarationeffect
addnoadd new declaration to schema; process its children in add mode
addyesraise error
replacenoraise error
replaceyesretain existing declaration; process new children in replace mode; ignore existing children
changenoraise error
changeyesprocess identifiable children according to their modes; process unidentifiable children in replace mode; retain existing children where no replacement or change is provided
deletenoraise error
deleteyesignore existing declaration and its children

22.6 Combining TEI and Non-TEI Modules

In the simplest case, all that is needed to include a non-TEI module in a schema is to reference its RELAX NG source using the url attribute on moduleRef. The following specification, for example, creates a schema in which declarations from the non-TEI module svg11.rng (defining Standard Vector Graphics) are included. To avoid any risk of name clashes, the schema specifies that all TEI patterns generated should be prefixed by the string "TEI_".
<schemaSpec prefix="TEI_ident="testsvg"
 start="TEI svg">

 <moduleRef key="header"/>
 <moduleRef key="core"/>
 <moduleRef key="tei"/>
 <moduleRef key="textstructure"/>
 <moduleRef url="svg11.rng"/>
</schemaSpec>
This specification generates a single schema which might be used to validate either a TEI document (with the root element TEI), or an SVG document (with a root element <svg:svg>), but would not validate a TEI document containing <svg:svg> or other elements from the SVG language. For that to be possible, the <svg:svg> element must become a member of a TEI model class (1.3 The TEI Class System), so that it may be referenced by other TEI elements. To achieve this, we modify the last moduleRef in the above example as follows:
<moduleRef url="svg11.rng">
 <content>
  <rng:define name="TEI_model.graphicLike"
   combine="choice">

   <rng:ref name="svg"/>
  </rng:define>
 </content>
</moduleRef>

This states that when the declarations from the svg11.rng module are combined with those from the other modules, the declaration for the model class model.graphicLike in the TEI module should be extended to include the element <svg:svg> as an alternative. This has the effect that elements in the TEI scheme which define their content model in terms of that element class (notably figure) can now include it. A RELAX NG schema generated from such a specification can be used to validate documents in which the TEI figure element contains any valid SVG representation of a graphic, embedded within an <svg:svg> element.

22.7 Linking Schemas to XML Documents

Schemas can be linked to XML documents by means of the <?xml-model?> processing instruction described in the W3C Working Group Note Associating Schemas with XML documents (http://www.w3.org/TR/xml-model/). <?xml-model?> can be used for any type of schema, and may be used for multiple schemas:

<?xml-model href="tei_tite.rng" type="application/xml" ?>
<?xml-model href="checkLinks.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron" ?>
<?xml-model href="tei_tite.odd" type="application/tei+xml" schematypens="http://www.tei-c.org/ns/1.0" ?>

This example includes a standard RELAX NG schema, a Schematron schema which might be used for checking that all pointing attributes point at existing targets, and also a link to the TEI ODD file from which the RELAX NG schema was generated. See also 2.3.9 The Schema Specification for details of another method of linking an ODD specification into your file by including a schemaSpec element in encodingDesc.

22.8 Module for Documentation Elements

The module described in this chapter makes available the following components:

モジュール tagdocs: タグ定義モジュール

The selection and combination of modules to form a TEI schema is described in 1.2 Defining a TEI Schema.

The elements described in this chapter are all members of one of three classes: model.oddDecl, model.oddRef, or model.phrase.xml, with the exceptions of schemaSpec (a member of model.divPart) and both eg and egXML (members of model.common and model.egLike). All of these classes are declared along with the other general TEI classes, in the basic structure module documented in 1 The TEI Infrastructure.

In addition, some elements are members of the att.identified class, which is documented in 22.5 Building a Schema above, and make use of the macro.schemaPattern pattern, which is documented in 22.4.4 Element Specifications above.

注釈
87
ODD is short for ‘One Document Does it all’, and was the name invented by the original TEI Editors for the predecessor of the system currently used for this purpose. See further Burnard and Sperberg-McQueen (1995) and Burnard and Rahtz (2004).
88
The distinction between base and additional tagsets in earlier versions of the TEI scheme has not been carried forward into P5.

[English] [Deutsch] [Español] [Italiano] [Français] [日本語] [한국어] [中文]




TEI Guidelines Version 2.9.1. Last updated on 15th October 2015, revision 46ac023. This page generated on 2015-10-15T20:07:25Z.