Example: <constraintSpec> (constraint on schema)

These search results reproduce every example of the use of <constraintSpec> in the Guidelines, including all localised and translated versions. In some cases, the examples have been drawn from discussion of other elements in the Guidelines and illustrating the use of <constraintSpec> is not the main focus of the passage in question. In other cases, examples may be direct translations of each other, and hence identical from the perspective of their encoding.

23 Documentation Elements


23.5.2 Additional Constraints

<constraintSpec ident="ref-or-key-or-name"
 scheme="schematron">

 <constraint>
  <sch:rule context="tei:relation">
   <sch:assert test="@ref or @key or @name">One of the attributes @name, @ref or @key must be supplied</sch:assert>
  </sch:rule>
 </constraint>
</constraintSpec>
<constraintSpec ident="active-mutual"
 scheme="schematron">

 <constraint>
  <sch:rule context="tei:relation">
   <sch:report test="@active and @mutual">Only one of the attributes @active and @mutual may be supplied</sch:report>
  </sch:rule>
 </constraint>
</constraintSpec>
<constraintSpec ident="active-passive"
 scheme="schematron">

 <constraint>
  <sch:rule context="tei:relation">
   <sch:report test="@passive and not(@active)">the attribute @passive may be supplied only if the attribute @active is supplied</sch:report>
  </sch:rule>
 </constraint>
</constraintSpec>
⚓︎

23.5.2 Additional Constraints

<constraintSpec ident="subclauses"
 scheme="schematron">

 <constraint>
  <sch:ns prefix="tei"
   uri="http://www.tei-c.org/ns/1.0"/>

  <sch:rule context="tei:div">
   <sch:report test="count( tei:div ) eq 1">if it contains any subdivisions, a
       division must contain at least two of them</sch:report>
  </sch:rule>
 </constraint>
</constraintSpec>
⚓︎

23.5.2 Additional Constraints

<constraintSpec ident="introtitle"
 scheme="schematron">

 <constraint>
  <sch:rule context="tei:title">
   <sch:assert test="tei:fileDesc/tei:titleStmt/tei:title[@type='introductory']"> an introductory component of the title is expected</sch:assert>
  </sch:rule>
 </constraint>
</constraintSpec>
<constraintSpec ident="maintitle"
 scheme="schematron">

 <constraint>
  <sch:rule context="tei:title">
   <sch:assert test="tei:fileDesc/tei:titleStmt/tei:title[@type='main']"> a main title must be supplied</sch:assert>
  </sch:rule>
 </constraint>
</constraintSpec>
⚓︎

23.5.2 Additional Constraints

<constraintSpec ident="alt"
 scheme="schematron">

 <constraint>
  <sch:ns prefix="tei"
   uri="http://www.tei-c.org/ns/1.0"/>

  <sch:pattern id="altTags">
   <sch:rule context="tei:figure">
    <sch: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 </sch:report>
   </sch:rule>
  </sch:pattern>
 </constraint>
</constraintSpec>
⚓︎

23.5.2 Additional Constraints

<constraintSpec ident="tables"
 scheme="schematron">

 <constraint>
  <sch:ns prefix="tei"
   uri="http://www.tei-c.org/ns/1.0"/>

  <sch:pattern id="Tables">
   <sch:rule context="tei:table">
    <sch:assert test="tei:head">A <table> should have a caption, using a <head>
         element</sch:assert>
    <sch:report test="parent::tei:body">Do not use tables to lay out the document body</sch:report>
   </sch:rule>
  </sch:pattern>
 </constraint>
</constraintSpec>
⚓︎

23.5.2 Additional Constraints

<constraintSpec ident="title_ne_author"
 scheme="SPITBOL">

 <constraint> (output = leq(title,author) "title and author cannot be the same") </constraint>
</constraintSpec>
⚓︎

23.5.3.2 Value Specification

<attDef ident="ageAtDeath">
 <desc>age in years at death</desc>
 <datatype>
  <dataRef key="teidata.count"/>
 </datatype>
 <constraintSpec ident="lessThan150"
  scheme="schematron">

  <constraint>
   <sch:rule context="@ageAtDeath">
    <sch:assert test=". le 150">age at death must be an integer less than 150</sch:assert>
   </sch:rule>
  </constraint>
 </constraintSpec>
</attDef>
⚓︎

<constraint>

<constraintSpec ident="isoconstraint"
 scheme="schematron">

 <constraint>
  <sch:rule context="tei:constraint">
   <sch:assert test="tei:fileDesc/tei:titleStmt/tei:title[ @type eq 'main']">a main title must be supplied</sch:assert>
  </sch:rule>
 </constraint>
</constraintSpec>
Show all ⚓︎

<constraint>

<constraintSpec ident="local"
 scheme="private">

 <constraint>
   (output = (ident(title) ident(author) "You must supply a title or an author"))
 </constraint>
</constraintSpec>
Show all ⚓︎

<constraintSpec>

<constraintSpec ident="demo-c1"
 scheme="schematron">

 <desc>Enforce the presence of the <att>spanTo</att> attribute</desc>
 <constraint>
  <sch:rule context="tei:addSpan">
   <sch:assert test="@spanTo">The spanTo= attribute of <sch:name/> is required.</sch:assert>
  </sch:rule>
 </constraint>
</constraintSpec>
Show all ⚓︎

<constraintSpec>

<constraintSpec ident="demo-c2"
 scheme="schematron">

 <desc>Implement an accessibility rule which says that pictures
   should have textual explanations</desc>
 <constraint>
  <sch:rule context="tei:figure">
   <sch:report test="not( tei:figDesc | tei:head )">You should
       provide information in a figure from which
       we can construct an alt attribute in HTML</sch:report>
  </sch:rule>
 </constraint>
</constraintSpec>
Show all ⚓︎

<constraintSpec>

<constraintSpec ident="author_ne_title"
 scheme="SPITBOL">

 <constraint>
   (output = leq(title,author) "title and author cannot be the same")
 </constraint>
</constraintSpec>
Show all ⚓︎