<?xml version="1.0" encoding="UTF-8"?>
<TEI xml:lang="en"  
     xmlns="http://www.tei-c.org/ns/1.0"
     xmlns:rng="http://relaxng.org/ns/structure/1.0"
     xmlns:sch="http://purl.oclc.org/dsdl/schematron"
     n="testconstraint"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <teiHeader>
      <fileDesc>
         <titleStmt>
            <title>TEI with constraint setup</title>
            <author>Sebastian Rahtz</author>
         </titleStmt>
         <publicationStmt>
	   <p> </p>
	 </publicationStmt>
         <sourceDesc>
            <p>authored from scratch</p>
         </sourceDesc>
      </fileDesc>
   </teiHeader>
<text>
<body>
<divGen type="toc"/>
<div>
<head>My Constraint Schema</head>
<p>Here is the introduction to your document</p>
  <p>Here is the schema:</p>
    <schemaSpec ident="testconstraint" start="TEI">
      <moduleRef key="analysis"/>
      <moduleRef key="header"/>
      <moduleRef key="core"/>
      <moduleRef key="tei"/>
      <moduleRef key="namesdates"/>
      <moduleRef key="textstructure"/>
      <elementSpec ident="div" mode="change">
	<constraintSpec mode="add" ident="canondiv"
		    scheme="isoschematron">
	  <constraint>
	    <sch:report test="@type='canon' and
			      parent::tei:div/@type='canon'">
	      divs of type 'canon' may not be nested
	    </sch:report>
	    <sch:report test="@type='canon' and
			      parent::tei:div/@type='register'">
	      divs of type 'canon' may not be nested within 'register'
	    </sch:report>
	    <sch:report test="@type='canon' and count
			      (tei:div[@type='canonText']) &gt;1">
	      divs of type 'canon' may contain only one 'canonText'
	    </sch:report>
	    <sch:report test="@type='canonText' and 
			      not(parent::tei:div[@type='canon'])">
	      divs of type 'canonText' can only occur inside 'canon'
	    </sch:report>
	  </constraint>
	</constraintSpec>
      </elementSpec>
      <elementSpec ident="p" mode="change">
	  <constraintSpec mode="add" ident="c1" scheme="isoschematron">
	    <constraint>
	    <sch:report test="tei:list"> 
	    lists inside paragraphs not supported </sch:report>
	    </constraint>
	  </constraintSpec>
	  <constraintSpec mode="add" ident="c2"  scheme="isoschematron">
	    <constraint>
	      <sch:rule context="tei:p|tei:q">
		<sch:report test="contains(@rend,' ')"> 
		multi-valued rend is not supported </sch:report>
	      </sch:rule>
	    </constraint>
	  </constraintSpec>


	<attList>
	  <attDef ident="type" mode="change">
		<datatype><rng:data type="float"/></datatype>
	  </attDef>
	</attList>


      </elementSpec>

      <elementSpec ident="relation" mode="change" >
	 <constraintSpec ident="activepassive" mode="delete" scheme="isoschematron"/>
      </elementSpec>



    </schemaSpec>
</div>
</body>
</text>
</TEI>



