Example: <constraint> (constraint rules)

These search results reproduce every example of the use of <constraint> 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 <constraint> 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.

22 Documentation Elements


22.5.3 Additional Constraints

<constraintSpec ident="reforkeyorname"
 scheme="isoschematron">

 <constraint>
  <s:assert test="@ref or @key or @name">One of the
       attributes 'name', 'ref' or 'key' must be supplied</s:assert>
 </constraint>
</constraintSpec>
<constraintSpec ident="activemutual"
 scheme="isoschematron">

 <constraint>
  <s:report test="@active and @mutual">Only one of the
       attributes @active and @mutual may be supplied</s:report>
 </constraint>
</constraintSpec>
<constraintSpec ident="activepassive"
 scheme="isoschematron">

 <constraint>
  <s:report test="@passive and not(@active)">the
       attribute 'passive' may be supplied only if the attribute 'active' is supplied</s:report>
 </constraint>
</constraintSpec>

22.5.3 Additional Constraints

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

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

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

22.5.3 Additional Constraints

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

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

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

22.5.3 Additional Constraints

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

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

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

22.5.3 Additional Constraints

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

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

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

22.5.3 Additional Constraints

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

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

22.5.4.2 Value Specification

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

  <constraint>
   <s:assert test=". < 150"> age at death must be
         a number less than 150 </s:assert>
  </constraint>
 </constraintSpec>
</attDef>

<constraint>

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

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

<constraint>

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

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

<constraintSpec>

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

 <desc>Enforce the presence of the <att>spanTo</att> attribute</desc>
 <constraint>
  <sch:assert test="@spanTo">The spanTo= attribute of <sch:name/>
       is required.</sch:assert>
 </constraint>
</constraintSpec>

<constraintSpec>

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

 <desc>Implement an accessibility rule which says that pictures should
     have textual explanations</desc>
 <constraint>
  <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>
 </constraint>
</constraintSpec>

<constraintSpec>

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

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