Exemple: <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.4.4 Element Specifications

<constraintSpec ident="activemutual" scheme="isoschematron">
 <desc>Check mutually incompatible attributes</desc>
 <constraint>
  <sch:report test="@active and @mutual">Only one of the attributes
     'active' and 'mutual' may be supplied</sch:report>
  <sch:report test="@passive and not(@active)">the attribute 'passive'
     may be supplied only if the attribute 'active' is
     supplied</sch:report>
 </constraint>
</constraintSpec>

22.4.4 Element Specifications

<constraintSpec ident="alt" scheme="isoschematron">
 <constraint>
  <sch:pattern name="Alt tags">
   <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>

22.4.4 Element Specifications

<constraintSpec ident="tables" scheme="isoschematron">
 <constraint>
  <sch:pattern name="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>

22.4.4 Element Specifications

<constraintSpec ident="subclauses" scheme="isoschematron">
 <constraint>
  <sch:rule context="tei:div">
   <sch:assert test="not(tei:div) or count(tei:div)>1">a clause must contain
       at least two subclauses</sch:assert>
  </sch:rule>
 </constraint>
</constraintSpec>

22.4.4 Element Specifications

<constraintSpec ident="introtitle" scheme="isoschematron">
 <constraint>
  <sch:assert
    test="tei:fileDesc/tei:titleStmt/tei:title[@type='introductory']">
An introductory component of the title is expected
  </sch:assert>
 </constraint>
</constraintSpec>
<constraintSpec ident="maintitle" scheme="isoschematron">
 <constraint>
  <sch:assert
    test="tei:fileDesc/tei:titleStmt/tei:title[@type='main']">
An main component of the title is expected
  </sch: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>
  <s:assert test="@spanTo">The spanTo= attribute of <s:name/>
     is required.</s: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>
  <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>

<constraintSpec>

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