<constraintSpec>

<constraintSpec> (constraint on schema) contains a constraint, expressed in some formal syntax, which cannot be expressed in the structural content model 22.4.4 Element Specifications
Modulo tagdocs — 22 Documentation Elements
Oltre agli attributi globali att.identified (@ident, @predeclare, @module, @mode) att.typed (@type, @subtype)
scheme supplies the name of the language in which the constraints are defined
Stato Richiesto
I valori legali sono:
schematron
(Schematron)
isoschematron
(ISO Schematron)
xsl
(XSLT)
private
(private constraint language)
Usato da
Può contenere
Dichiarazione

<rng:element name="constraintSpec">
 <rng:ref name="att.global.attributes"/>
 <rng:ref name="att.identified.attributes"/>
 <rng:ref name="att.typed.attributes"/>
 <rng:attribute name="scheme">
  <rng:choice>
   <rng:value>schematron</rng:value>
   <rng:value>isoschematron</rng:value>
   <rng:value>xsl</rng:value>
   <rng:value>private</rng:value>
  </rng:choice>
 </rng:attribute>
 <rng:zeroOrMore>
  <rng:ref name="model.glossLike"/>
 </rng:zeroOrMore>
 <rng:optional>
  <rng:ref name="constraint"/>
 </rng:optional>
</rng:element>
element constraintSpec
{
   att.global.attributes,
   att.identified.attributes,
   att.typed.attributes,
   attribute scheme { "schematron" | "isoschematron" | "xsl" | "private" },
   model.glossLike*,
   constraint?
}
Relationship between scheme attribute and contents

<s:ns prefix="s" uri="http://www.ascc.net/xml/schematron"/>
<s:report
 test="tei:constraint/s:* and not(@scheme='schematron')">
Rules in the Schematron 1.* language must be inside
a constraint with a value of 'schematron' on the scheme attribute
</s:report>

<s:ns prefix="sch" uri="http://purl.oclc.org/dsdl/schematron"/>
<s:report
 test="tei:constraint/sch:* and not(@scheme='isoschematron')">
Rules in the ISO Schematron language must be inside
a constraint with a value of 'isoschematron' on the scheme attribute
</s:report>
Esempio

This constraint uses Schematron to enforce the presence of the spanTo attribute (which comes from an attribute class) on the addSpan element:

<constraintSpec ident="demo-c1" scheme="isoschematron">
 <desc>Enforce the presence of the <att>spanTo</att> attribute</desc>
 <constraint>
  <s:assert test="@spanTo">The spanTo= attribute of <s:name/>
     is required.</s:assert>
 </constraint>
</constraintSpec>
Esempio
<constraintSpec ident="demo-c2" scheme="isoschematron">
 <desc>Implement an accessibility rule which says that pictures should
   have textual explanations</desc>
 <constraint>
  <s:report test="not(tei:figDesc or tei:head)"> You should
     provide information in a figure from which
     we can construct an alt attribute in HTML </s:report>
 </constraint>
</constraintSpec>
Esempio

This constraint uses a language which is not expressed in XML to check whether the title and author are identical:

<constraintSpec ident="local" scheme="private">
 <constraint>
   (output = leq(title,author) "title and author cannot be the same")
 </constraint>
</constraintSpec>