<attDef>

<attDef> (attribute definition) contains the definition of a single attribute. [22.4.5 Attribute List Specification]
Moduletagdocs — Documentation Elements
Attributesatt.global (@xml:id, @n, @xml:lang, @xml:base, @xml:space) (att.global.rendition (@rend, @style, @rendition)) (att.global.linking (@corresp, @synch, @sameAs, @copyOf, @next, @prev, @exclude, @select)) (att.global.analytic (@ana)) (att.global.facs (@facs)) (att.global.change (@change)) (att.global.responsibility (@cert, @resp)) att.identified (@ident, @predeclare, @module) (att.combinable (@mode) (att.deprecated (@validUntil)) )
usagespecifies the optionality of the attribute.
Status Optional
Datatype

<rng:ref name="data.enumerated"/>
data.enumerated
Legal values are:
req
(required)
rec
(recommended )
opt
(optional ) [Default]
ns(namespace) specifies the namespace to which this attribute belongs
Status Optional
Datatype

<rng:ref name="data.namespace"/>
data.namespace
Default http://www.tei-c.org/ns/1.0
Contained by
tagdocs: attList
May contain
Declaration

<rng:element name="attDef">
 <rng:ref name="att.global.attributes"/>
 <rng:ref name="att.global.rendition.attributes"/>
 <rng:ref name="att.global.linking.attributes"/>
 <rng:ref name="att.global.analytic.attributes"/>
 <rng:ref name="att.global.facs.attributes"/>
 <rng:ref name="att.global.change.attributes"/>
 <rng:ref name="att.global.responsibility.attributes"/>
 <rng:ref name="att.identified.attributes"/>
 <rng:ref name="att.combinable.attributes"/>
 <rng:ref name="att.deprecated.attributes"/>
 <rng:optional>
  <rng:attribute name="usage"
   a:defaultValue="opt">

   <xhtml:dl class="valList"/>
  </rng:attribute>
 </rng:optional>
 <rng:optional>
  <rng:attribute name="ns"
   a:defaultValue="http://www.tei-c.org/ns/1.0">

   <rng:ref name="data.namespace"/>
  </rng:attribute>
 </rng:optional>
 <rng:group>
  <rng:zeroOrMore>
   <rng:choice>
    <rng:ref name="model.glossLike"/>
    <rng:ref name="model.descLike"/>
   </rng:choice>
  </rng:zeroOrMore>
  <rng:optional>
   <rng:ref name="datatype"/>
  </rng:optional>
  <rng:zeroOrMore>
   <rng:ref name="constraintSpec"/>
  </rng:zeroOrMore>
  <rng:optional>
   <rng:ref name="defaultVal"/>
  </rng:optional>
  <rng:optional>
   <rng:choice>
    <rng:ref name="valList"/>
    <rng:oneOrMore>
     <rng:ref name="valDesc"/>
    </rng:oneOrMore>
   </rng:choice>
  </rng:optional>
  <rng:zeroOrMore>
   <rng:ref name="exemplum"/>
  </rng:zeroOrMore>
  <rng:zeroOrMore>
   <rng:ref name="remarks"/>
  </rng:zeroOrMore>
 </rng:group>
</rng:element>
element attDef
{
   att.global.attributes,
   att.global.rendition.attributes,
   att.global.linking.attributes,
   att.global.analytic.attributes,
   att.global.facs.attributes,
   att.global.change.attributes,
   att.global.responsibility.attributes,
   att.identified.attributes,
   att.combinable.attributes,
   att.deprecated.attributes,
   attribute usage { text }?,
   attribute ns { data.namespace }?,
   (
      ( model.glossLike | model.descLike )*,
      datatype?,
      constraintSpec*,
      defaultVal?,
      ( valList | valDesc+ )?,
      exemplum*,
      remarks*
   )
}
Schematron

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

<s:assert test="ancestor::teix:egXML[@valid='feasible'] or @mode eq 'change' or @mode eq 'delete' or tei:datatype or tei:valList[@type='closed']">Attribute: the definition of the @<s:value-of select="@ident"/> attribute in the <s:value-of select="ancestor::*[@ident][1]/@ident"/>
<s:value-of select="' '"/>
<s:value-of select="local-name(ancestor::*[@ident][1])"/> should have a closed valList or a datatype</s:assert>
Schematron

<sch:rule context="tei:attDef[@usage eq 'req']">
<sch:report test="tei:defaultVal">It does not make sense to make "<sch:value-of select="normalize-space(tei:defaultVal)"/>" the default value of @<sch:value-of select="@ident"/>, because that attribute is required.</sch:report></sch:rule>
Schematron

<sch:rule context="tei:attDef[ tei:defaultVal and tei:valList[@type eq 'closed'] and tei:datatype[ @maxOccurs > 1 or @minOccurs > 1 or @maxOccurs = 'unbounded' ] ]">
<sch:assert test=" tokenize(normalize-space(tei:defaultVal),' ') = tei:valList/tei:valItem/@ident">In the <sch:value-of select="local-name(ancestor::*[@ident][1])"/> defining
<sch:value-of select="ancestor::*[@ident][1]/@ident"/> the default value of the
@<sch:value-of select="@ident"/> attribute is not among the closed list of possible
values</sch:assert></sch:rule>
Schematron

<sch:rule context="tei:attDef[ tei:defaultVal and tei:valList[@type eq 'closed'] and tei:datatype[ not(@maxOccurs) or ( if ( @maxOccurs castable as xs:integer ) then ( @maxOccurs cast as xs:integer eq 1 ) else false() )] ]">
<sch:assert test="string(tei:defaultVal) = tei:valList/tei:valItem/@ident">In the <sch:value-of select="local-name(ancestor::*[@ident][1])"/> defining
<sch:value-of select="ancestor::*[@ident][1]/@ident"/> the default value of the
@<sch:value-of select="@ident"/> attribute is not among the closed list of possible
values</sch:assert></sch:rule>
Example
<attDef usage="recident="type">
 <desc>specifies a name conventionally used for this level of subdivision, e.g.
 <val>act</val>, <val>volume</val>, <val>book</val>, <val>section</val>, <val>canto</val>,
   etc.</desc>
 <datatype>
  <rng:text/>
 </datatype>
</attDef>