<?xml version="1.0" encoding="UTF-8"?>
<!-- © TEI Consortium. Dual-licensed under CC-by and BSD2 licenses; see the file COPYING.txt for details. -->
<?xml-model href="https://jenkins.tei-c.org/job/TEIP5-dev/lastSuccessfulBuild/artifact/P5/release/xml/tei/odd/p5.nvdl" type="application/xml" schematypens="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"?>
<elementSpec xmlns="http://www.tei-c.org/ns/1.0" xmlns:sch="http://purl.oclc.org/dsdl/schematron" module="tagdocs" xml:id="gi-dataRef" ident="dataRef">
  <desc versionDate="2010-05-14" xml:lang="en">identifies the datatype of an attribute value, either by referencing an item in an externally defined datatype library, or by
    pointing to a TEI-defined data specification</desc>
  <desc versionDate="2024-09-02" xml:lang="ja">外部で定義されたデータ型ライブラリ内の項目を参照するか、もしくはTEIにより定義されたデータ仕様を指し示すことで、属性値のデータ型を識別する</desc>
  <classes>
    <memberOf key="att.global"/>
    <memberOf key="model.contentPart"/>
    <memberOf key="model.oddRef"/>
  </classes>
  <content>
    <elementRef minOccurs="0" maxOccurs="unbounded" key="dataFacet"/>
  </content>
  <constraintSpec ident="restrictDataFacet" scheme="schematron" xml:lang="en">
    <constraint>
      <sch:rule context="tei:dataRef[tei:dataFacet]">
        <sch:assert test="@name" role="nonfatal">Data facets can only be specified for references to datatypes specified by
          XML Schema Part 2: Datatypes Second Edition — that is, for there to be a 'dataFacet' child there must be a @name attribute.</sch:assert>
        <sch:report test="@restriction" role="nonfatal">Data facets and restrictions cannot both be expressed on the same data reference — that is, the @restriction attribute cannot be used when a 'dataFacet' element is present.</sch:report>
      </sch:rule>
    </constraint>
  </constraintSpec>
  <constraintSpec ident="restrictAttResctrictionName" scheme="schematron" xml:lang="en">
    <constraint>
      <sch:rule context="tei:dataRef[@restriction]">
        <sch:assert test="@name" role="nonfatal">Restrictions can only be specified for references to datatypes specified by
          XML Schema Part 2: Datatypes Second Edition — that is, for there to be a @restriction attribute there must be a @name attribute, too.</sch:assert>
      </sch:rule>
    </constraint>
  </constraintSpec>
  <attList>
    <attList org="choice">
      <attDef ident="key" usage="req">
        <desc versionDate="2010-05-14" xml:lang="en">the identifier used for this datatype specification</desc>
        <desc versionDate="2024-09-02" xml:lang="ja">このデータ型仕様に使われる識別子</desc>
        <datatype><dataRef key="teidata.xmlName"/></datatype>
      </attDef>
      <attDef ident="name" usage="req">
        <desc versionDate="2010-05-14" xml:lang="en">the name of a datatype in the list provided by 
        <ref target="#XSD2">XML Schema Part 2: Datatypes Second Edition</ref></desc>
        <desc versionDate="2024-09-02" xml:lang="ja"><ref target="#XSD2">XML Schemas: Part 2: Datatypes</ref>で提供されているリスト内のデータ型の名前</desc>
        <datatype><dataRef key="teidata.xmlName"/></datatype>
      </attDef>
      <attDef ident="ref" usage="req">
        <desc versionDate="2010-05-14" xml:lang="en">a pointer to a datatype defined in some datatype library</desc>
        <desc versionDate="2024-09-02" xml:lang="ja">あるデータ型ライブラリ内で定義されたデータ型へのポインタ</desc>
        <datatype><dataRef key="teidata.pointer"/></datatype>
      </attDef>
    </attList>
    <attDef ident="restriction">
      <desc versionDate="2012-12-04" xml:lang="en">supplies a string representing a regular expression providing additional constraints 
      on the strings used to represent values of this datatype</desc>
      <desc versionDate="2024-09-02" xml:lang="ja">このデータ型の値を表すために使用される文字列に追加の制約を加える正規表現を表す文字列を提供する</desc>
     <datatype><dataRef key="teidata.pattern"/></datatype>
   </attDef>
  </attList>
  <exemplum xml:lang="en">
    <egXML xmlns="http://www.tei-c.org/ns/Examples" xml:id="gi-dataRef-egXML-ts" source="#UND">
      <schemaSpec ident="myTEI" source="http://www.tei-c.org/Vault/P5/current/xml/tei/odd/p5subset.xml">
        <!-- ... -->
        <dataRef key="teidata.enumerated"/>
        <!-- ... -->
      </schemaSpec>
    </egXML>
  </exemplum>
  <exemplum xml:lang="en">
    <egXML xmlns="http://www.tei-c.org/ns/Examples" xml:id="gi-dataRef-egXML-zp" source="#UND">
      <schemaSpec ident="myTEI" source="http://www.tei-c.org/Vault/P5/current/xml/tei/odd/p5subset.xml">
        <!-- ... -->
        <dataRef name="float"/>
        <!-- ... -->
      </schemaSpec>
    </egXML></exemplum>
    <exemplum xml:lang="und">
      <egXML xmlns="http://www.tei-c.org/ns/Examples" xml:id="gi-dataRef-egXML-rg">
        <dataSpec ident="data.integerExample">
          <desc>datatype used for attributes taking an integer value between 0 and 99</desc>     
     <content>   <dataRef name="nonNegativeInteger" restriction="[0-9][0-9]?"/>
    </content>    </dataSpec>
      </egXML>
    </exemplum>
    
  <remarks versionDate="2010-05-14" xml:lang="en">
    <p>Only one of the attributes <att>key</att>, <att>name</att>, and <att>ref</att> may be used on any given instance of <gi>dataRef</gi>.</p>
    <p>Neither a <att>restriction</att> attribute nor a <gi>dataFacet</gi> child element may be used unless the <gi>dataRef</gi> refers to a datatype from the specification <ref target="#XSD2">XML Schema Part 2: Datatypes Second Edition</ref> with a <att>name</att> attribute.</p>
  </remarks>
  <remarks versionDate="2024-09-02" xml:lang="ja"><p> <att>key</att>, <att>name</att>, <att>ref</att>の内どれか一つの属性のみを使用することができる</p></remarks>
  <listRef>
    <ptr target="#TD-datatypes"/>
  </listRef>
</elementSpec>
