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.2 Personalization and Customization and 23.3 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.77 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.
- formal reference documentation for elements, attributes, element classes, patterns, etc. such as those provided in 付録 C Elements below;
- detailed descriptive documentation, embedding some parts of the formal reference documentation, such as the tag description lists provided in this and other chapters of these Guidelines;
- declarative code for one or more XML schema languages, specifically RELAX NG or W3C Schema.
- declarative code for fragments which can be assembled to make up an XML Document Type Declaration.
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 the module defined by this chapter. In order to support more than one schema language, this module uses a comparatively high-level model which can then be mapped by an ODD processor to the specific constructs appropriate to 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. We do however use the ISO standard XML schema language RELAX NG (http://www.relaxng.org) as a means of declaring content models, rather than inventing a completely new XML-based representation for them.
In the TEI abstract model, a markup scheme (a schema) consists of a number of discrete modules, which can 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 declared globally; 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 elements 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.7 Module for Documention Elements gives an overview of the whole module.
22.1 Phrase Level Documentary ElementsTEI: Phrase Level Documentary Elements¶
22.1.1 Phrase Level TermsTEI: Phrase Level Terms¶
- code
プログラミング言語のような形式言語のコードを示す.
lang (formal language) 当該コードの形式言語名を示す. - ident (identifier) 形式言語にあるオブジェクトの識別子または名前を示す.
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.
- att 属性の名前を示す.
- gi 要素の名前(共通識別子)を含む.
- tag 完全な開始タグ,終了タグのテキストを示す.属性規定はとることも可能だ が,タグ開始区切子,タグ終了区切子は含まない.
- val 属性値をひとつ示す.
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>
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 specialised 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.
- att.xmlspace
W3Cによる属性xml:spaceを使った空白処理と関連するTEI要素をまとめる.
xml:space 空白文字がソフトウェアの処理で保持されるべきであることを示す.
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 DescriptionsTEI: Element and Attribute Descriptions¶
<head>Element and attribute descriptions</head>
<p>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 <ptr target="#TDcrystals"/>, in particular the
brief prose descriptions these provide for elements and attributes.
<specList>
<specDesc key="specList"/>
<specDesc key="specDesc"/>
</specList>
</p>
<p>TEI practice requires that a <gi>specList</gi> listing the elements
...
</p>
<!-- ... -->
</div3>
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 must 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 SchemasTEI: Modules and Schemas¶
- schemaSpec (schema specification) TEI準拠のスキーマや文書を示す.
- moduleSpec (module specification) いちモジュールの構造,内容,目的を記録する.例えば,外部から名前で参 照可能な宣言集合などである.
- moduleRef (module reference) スキーマに組み入れられるモジュールを参照する.
- specGrp 当該モジュール中にある規定をまとめる.
- specGrpRef/ 要素specGrpにより含まれる宣言が,この場所に挿入されるべきこ とを示す.
- attRef/ 1つまたは複数の属性の定義の場所を示す.
<altIdent type="FPI">Names and Dates</altIdent>
<desc>Additional elements for names and dates</desc>
</moduleSpec>
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: the distinction between base and additional tagsets in earlier versions of the TEI scheme has not been carried forward into P5.
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 a moduleSpec element is not in general affected by the order of declarations within a specGrp.
<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>
<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>
22.3 Specification ElementsTEI: Specification Elements¶
- elementSpec (element specification) 構造,内容,その要素の目的などを示す.
- classSpec (class specification)
TEI要素クラスにおける参照情報を示す.内容モデルに出現する要素のまと
まり,共通する属性のまとまり,またはその両方.
generate モデルクラスのインスタンスとしてある選択肢を示す.デフォルトでは, あらゆるものが可能である. - macroSpec (macro specification) パタンの機能や実装を解説する.
Unlike most elements in the TEI scheme, each of these elements has a fairly rigid internal structure consisting of a large number of child elements which are always presented in the same order. For this reason, we refer to them metaphorically as ‘crystals’. 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 ElementsTEI: Common Elements¶
This section discusses the child elements common to all of the specification elements. These child elements are used to specify the naming, description, exemplification, and classification of the specification elements.
22.4.1 Description of ComponentsTEI: Description of Components¶
<desc>Name of an actor appearing within a cast list.</desc>
<desc xml:lang="ja"> 登場人物リスト中にある役者名を示す.</desc>
<desc xml:lang="it">nome di un attore che appare nella lista dei personaggi.</desc>
<!-- ... -->
</elementSpec>
<!--... -->
<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>
<ptr target="#COHQHF"/>
</listRef>
22.4.2 Exemplification of ComponentsTEI: Exemplification of Components¶
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.
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. If it is well-formed but not valid, then it should be enclosed in a CDATA marked section within an egXML.
An 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 ComponentsTEI: Classification of Components¶
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.
<memberOf key="model.phrase.xml"/>
</classes>
22.4.4 Element SpecificationsTEI: Element Specifications¶
The content of the element content may be expressed in one of two ways. 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. Alternatively, the legal content for an element may be fully specified using the valList element, described in 22.4.5 Attribute List Specification below.
In the case of the TEI Guidelines, element content models are defined using RELAX NG patterns, but the user may over-ride this by redefining this pattern.
<rng:text/>
</content>
<rng:group>
<rng:ref name="fileDesc"/>
<rng:zeroOrMore>
<rng:ref name="model.headerPart"/>
</rng:zeroOrMore>
<rng:optional>
<rng:ref name="revisionDesc"/>
</rng:optional>
</rng:group>
</content>
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.headerPart are always class names. In DTD language, classes are represented by parameter entities (%model.headerPart; in the above example); see further 1 The TEI Infrastructure.
22.4.5 Attribute List SpecificationTEI: 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 also contain nested attribute lists.
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 DatatypesTEI: Datatypes¶
<rng:text/>
</datatype>
<rng:data type="Boolean"/>
</datatype>
<rng:choice>
<rng:data type="Date"/>
<rng:data type="Float"/>
</rng:choice>
</datatype>
22.4.5.2 Value SpecificationTEI: Value Specification¶
element logically preceding this
one.</valDesc>
headings.</valDesc>
taken from the list in <title>Pollard and Redgrave</title>
</valDesc>
As noted above, the datatype element constrains the possible values for an attribute. The valDesc element can be used to describe further constraints. For example, to specify that an attribute age can take positive integer values less than 100, the datatype data.numeric might be used in combination with a valDesc such as ‘values must be positive integers less than 100’.
<valItem ident="req">
<gloss>required</gloss>
</valItem>
<valItem ident="mwa">
<gloss>mandatory when applicable</gloss>
</valItem>
<valItem ident="rec">
<gloss>recommended</gloss>
</valItem>
<valItem ident="rwa">
<gloss>recommended when applicable</gloss>
</valItem>
<valItem ident="opt">
<gloss>optional</gloss>
</valItem>
</valList>
The valList element is also used to provide illustrative examples of the kinds of values expected. In such cases the type attribute will have the value open and the datatype will usually be data.enumerated.
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).
22.4.5.3 ExamplesTEI: Examples¶
<attDef ident="type">
<desc>describes the form of the list.</desc>
<datatype>
<rng:text/>
</datatype>
<defaultVal>simple</defaultVal>
<valList type="semi">
<valItem ident="ordered">
<desc>list items are numbered or lettered. </desc>
</valItem>
<valItem ident="bulleted">
<desc>list items are marked with a bullet or other
typographic device. </desc>
</valItem>
<valItem ident="simple">
<desc>list items are not numbered or bulleted.</desc>
</valItem>
<valItem ident="gloss">
<desc>each list item glosses some term or
concept, which is given by a label element preceding
the list item.</desc>
</valItem>
</valList>
<remarks>
<p>The formal syntax of the element declarations allows
<gi>label</gi> tags to be omitted from lists tagged <tag>list
type="gloss"</tag>; this is however a semantic error.</p>
</remarks>
</attDef>
</attList>
<attDef ident="bax">
<!-- ... -->
</attDef>
<attList org="choice">
<attDef ident="bar">
<!-- ... -->
</attDef>
<attDef ident="baz">
<!-- ... -->
</attDef>
</attList>
</attList>
22.4.6 Element ClassesTEI: Element Classes¶
<memberOf key="model.hiLike"/>
</classes>
<desc>groups phrase-level elements related to highlighting that have
no specific semantics </desc>
<classes>
<memberOf key="model.highlighted"/>
</classes>
</classSpec>
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 neeeded 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.
<rng:zeroOrMore>
<rng:ref name="model.hiLike"/>
</rng:zeroOrMore>
</content>
<rng:zeroOrMore>
<rng:choice>
<rng:ref name="hi"/>
<rng:ref name="it"/>
<rng:ref name="bo"/>
</rng:choice>
</rng:zeroOrMore>
</content>
<rng:zeroOrMore>
<rng:ref name="hi"/>
<rng:ref name="it"/>
<rng:ref name="bo"/>
</rng:zeroOrMore>
</content>
- 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
<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>
<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>
<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 principal, 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" generateOnly="sequence sequenceOptional"> then a content model referring to (say) model.hiLike_sequenceRepeatable would be regarded as invalid by an ODD processor.
When a classSpec contains an attList element, all the members of that class inherit the attributes specified by 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, the membership of which may be expanded by some modules.
22.4.7 Pattern DocumentationTEI: Pattern Documentation¶
22.5 Building a SchemaTEI: Building a Schema¶
- att.identified
属性keyで参照されている要素に付与する属性を示す.
ident 当該要素を参照する識別子を示す. predeclare 当該オブジェクトが,TEI基盤モジュー ルで事前に宣言されるべきかどうかを示す. module 当該オブジェクトが定義されているモジュール名を示す. mode 当該宣言が親要素に与える影響を示す.
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.
<moduleRef key="teistructure"/>
<moduleRef key="linking"/>
</schemaSpec>
<moduleRef key="teiheader"/>
<moduleRef key="verse"/>
<elementSpec ident="soundClip">
<classes>
<memberOf key="model.pPart.data"/>
</classes>
</elementSpec>
</schemaSpec>
<moduleRef key="teiheader"/>
<moduleRef key="teistructure"/>
<elementSpec ident="head" mode="change">
<content>
<rng:ref name="macro.xtext"/>
</content>
</elementSpec>
</schemaSpec>
mode value | existing declaration | effect |
add | no | add new declaration to schema; process its children in add mode |
add | yes | raise error |
replace | no | raise error |
replace | yes | retain existing declaration; process new children in replace mode; ignore existing children |
change | no | raise error |
change | yes | process identifiable children according to their modes; process unidentifiable children in replace mode; retain existing children where no replacement or change is provided |
delete | no | raise error |
delete | yes | ignore existing declaration and its children |
22.6 Combining TEI and Non-TEI ModulesTEI: Combining TEI and Non-TEI Modules¶
<moduleRef key="header"/>
<moduleRef key="core"/>
<moduleRef key="tei"/>
<moduleRef key="textstructure"/>
<moduleRef url="svg11.rng"/>
</schemaSpec>
<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 Module for Documention ElementsTEI: Module for Documention Elements¶
- モジュール tagdocs: タグ定義モジュール
- 定義済み要素: altIdent att attDef attList attRef classSpec classes code content datatype defaultVal eg egXML elementSpec equiv exemplum gi ident listRef macroSpec memberOf moduleRef moduleSpec remarks schemaSpec specDesc specGrp specGrpRef specList stringVal tag val valDesc valItem valList
- 定義済みクラス: att.identified
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.
↑ 目次 « 21 Certainty and Responsibility » 23 Using the TEI