<?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-constraintDecl" ident="constraintDecl">
  <gloss versionDate="2023-03-09" xml:lang="en">constraint declaration</gloss>
  <desc versionDate="2023-03-09" xml:lang="en">contains declarations pertaining to formal constraints expressed elsewhere in <gi>constraintSpec</gi> elements</desc>
  <classes>
    <memberOf key="att.global"/>
    <memberOf key="model.encodingDescPart"/>
    <!-- <constraintDecl> is part of content of <schemaSpec> directly, not via a class -->
  </classes>
  <content>
    <sequence>
      <alternate minOccurs="0" maxOccurs="unbounded">
        <classRef key="model.identEquiv"/>
        <classRef key="model.descLike"/>
      </alternate>
      <anyElement minOccurs="0" maxOccurs="unbounded"/>             <!-- typically <sch:ns> elements -->
    </sequence>
  </content>
  <!-- NOTE: Also see constraint "context-required" in file constraintSpec.xml,
       which may be fired on a <constraintDecl> as well. -->
  <constraintSpec scheme="schematron" ident="one-constraintDecl-per-scheme" xml:lang="en">
    <!-- Note: the “not a descendant of <egXML>” predicate on the
         XPath defining $schemes is required for the P5 build process,
         not for normal users. (In P5 build validity of <egXML>s are
         tested by changing their namespace to TEI, so the tei: prefix
         is not sufficient.) —Syd, 2024-09-19 -->
    <constraint>
      <sch:rule context="/*[ count( //tei:constraintDecl ) gt 1 ]">
        <sch:let name="schemes" value="//tei:constraintDecl[ not(ancestor::*[local-name(.) eq 'egXML'] ) ]/@scheme"/>
        <sch:let name="disctinct_schemes" value="distinct-values( $schemes )"/>
        <sch:assert test="count( $schemes ) eq count( $disctinct_schemes )">
          Each &lt;constraintDecl> element should have a @scheme attribute that is distinct from that of all the other &lt;constraintDecl>s.
        </sch:assert>
      </sch:rule>
    </constraint>
  </constraintSpec>
  <attList>
    <attDef ident="scheme" usage="req">
      <desc versionDate="2023-03-09" xml:lang="en">supplies the name of the language to which the declarations herein apply</desc>
      <datatype><dataRef key="teidata.enumerated"/></datatype>
      <valList type="semi">
        <valItem ident="schematron">
          <gloss versionDate="2016-09-27" xml:lang="en">ISO Schematron</gloss>
        </valItem>
      </valList>
      <remarks versionDate="2023-03-09" xml:lang="en">
        <p>The declarations contained in a particular
        <gi>constraintDecl</gi> (including <att>queryBinding</att>, if
        present) apply to the <gi>constraintSpec</gi> elements whose
        <att>scheme</att> matches the <att>scheme</att> of the
        <gi>constraintDecl</gi>.</p>
      </remarks>
    </attDef>
    <attDef ident="queryBinding" usage="rec">
      <gloss xml:lang="en" versionDate="2023-03-09">query language binding</gloss>
      <desc xml:lang="en" versionDate="2023-03-09">specifies the query
      language binding for rule-based schema expressions in
      <gi>constraintSpec</gi> elements that have a matching
      <att>scheme</att> attribute</desc>
      <datatype><dataRef key="teidata.enumerated"/></datatype>
      <valList type="semi">
        <valItem ident="exslt"/>
        <valItem ident="stx"/>
        <valItem ident="xslt"/>
        <valItem ident="xslt2"/>
        <valItem ident="xslt3"/>
        <valItem ident="xpath"/>
        <valItem ident="xpath2"/>
        <valItem ident="xpath3"/>
        <valItem ident="xpath31"/>
        <valItem ident="xquery"/>
        <valItem ident="xquery3"/>
        <valItem ident="xquery31"/>
      </valList>
      <remarks versionDate="2023-03-09" xml:lang="en">
        <p>The suggested values above are the values reserved by the
        Schematron specification. Only <val>exslt</val>,
        <val>stx</val>, <val>xslt</val>, <val>xslt2</val>,
        <val>xslt3</val>, <val>xpath2</val>, and <val>xpath3</val> are
        defined by the specification. Most processors only support one
        or more of <val>xslt</val>, <val>xslt2</val>, and
        <val>xslt3</val>.</p>
      </remarks>
    </attDef>
  </attList>
  <exemplum xml:lang="en">
    <egXML xmlns="http://www.tei-c.org/ns/Examples">
      <constraintDecl scheme="schematron" queryBinding="xslt3">
        <sch:ns prefix="wwp" uri="http://www.wwp.northeastern.edu/ns/textbase"/>
      </constraintDecl>
    </egXML>
  </exemplum>
  <listRef>
    <ptr target="#TDTAGCONS"/>
  </listRef>
</elementSpec>
