Skip to content

<attDef>

attribute definition

contains the definition of a single attribute.

Module tagdocsTDATT

Attributes

@usagespecifies the optionality of the attribute.
Status
Optional
Datatype
teidata.enumerated
Legal values
req
(required)
rec
(recommended)
opt
(optional)

Classes and content

May contain
Contained by

tagdocs

Example

<attDef usage="rec" ident="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>
    <dataRef key="teidata.word"/>
  </datatype>
</attDef>

Schematron

<constraintSpec xmlns:sch="http://purl.oclc.org/dsdl/schematron" ident="attDefContents" scheme="schematron" xml:lang="en">
    <constraint>
      <sch:ns prefix="teix" uri="http://www.tei-c.org/ns/Examples"/>
      <sch:rule context="tei:attDef">
        <sch:assert test="ancestor::teix:egXML[ @valid eq 'feasible']                        or @mode eq 'change'                        or @mode eq 'delete'                        or tei:datatype                        or tei:valList[ @type eq 'closed']">
          Attribute: the definition of the @<sch:value-of select="@ident"/> attribute in the
          "<sch:value-of select="ancestor::*[@ident][1]/@ident"/>"
          <sch:value-of select="' &lt;'"/>
          <sch:value-of select="local-name(ancestor::*[@ident][1])"/>&gt;
          should have a child &lt;valList&gt; with a @type of "closed" or
          a child &lt;datatype&gt;.
        </sch:assert>
      </sch:rule>
    </constraint>
  </constraintSpec>
<constraintSpec xmlns:sch="http://purl.oclc.org/dsdl/schematron" ident="noDefault4Required" scheme="schematron" xml:lang="en">
    <constraint>
      <sch:rule context="tei:attDef[@usage eq 'req']">
        <sch:report test="tei:defaultVal">Since the @<sch:value-of select="@ident"/> attribute is required, it will always be specified. Thus the default value (of "<sch:value-of select="normalize-space(tei:defaultVal)"/>") will never be used. Either change the definition of the attribute so it is not required ("rec" or "opt"), or remove the &lt;defaultVal&gt; element.</sch:report>
      </sch:rule>
    </constraint>
  </constraintSpec>
<constraintSpec xmlns:sch="http://purl.oclc.org/dsdl/schematron" ident="defaultIsInClosedList-twoOrMore" scheme="schematron" xml:lang="en">
    
    <constraint>
      <sch:rule context="tei:attDef[     tei:defaultVal                                      and tei:valList[ @type eq 'closed']                                      and tei:datatype[ @maxOccurs &gt; 1  or  @minOccurs &gt; 1  or  @maxOccurs eq 'unbounded']                                    ]">
        <sch:assert test="tokenize(normalize-space(tei:defaultVal),' ') = tei:valList/tei:valItem/@ident">In the &lt;<sch:value-of select="local-name(ancestor::*[@ident][1])"/>&gt; 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>
    </constraint>
  </constraintSpec>
<constraintSpec xmlns:sch="http://purl.oclc.org/dsdl/schematron" ident="defaultIsInClosedList-one" scheme="schematron" xml:lang="en">
    <constraint>
      <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 &lt;<sch:value-of select="local-name(ancestor::*[@ident][1])"/>&gt; 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>
    </constraint>
  </constraintSpec>

Content model

<content>
    <sequence>      
        <alternate minOccurs="0" maxOccurs="unbounded">
          <classRef key="model.identSynonyms"/>
          <classRef key="model.descLike"/>
        </alternate>
        <elementRef key="datatype" minOccurs="0"/>
        <elementRef key="constraintSpec" minOccurs="0" maxOccurs="unbounded"/>
        <elementRef key="defaultVal" minOccurs="0"/>
        <alternate minOccurs="0">
          <elementRef key="valList"/>     
          <elementRef key="valDesc" minOccurs="1" maxOccurs="unbounded"/>
        </alternate>
        <elementRef key="exemplum" minOccurs="0" maxOccurs="unbounded"/>
        <elementRef key="remarks" minOccurs="0" maxOccurs="unbounded"/>
    </sequence>
  </content>