1 <?xml version="1.0" encoding="UTF-8"?>
    2 <sch:schema xmlns:sch="http://www.ascc.net/xml/schematron">
    3    
    4    <sch:title>DocSouth TEI Document Test</sch:title>
    5    
    6    <sch:pattern name="All name elements for people must have a key begining with pn.">
    7       <sch:rule context="/TEI.2/text//name[@type='person']">
    8          <sch:assert test="substring(./@key, 1, 2) = 'pn'">All keys for names of people must begin with "pn".</sch:assert>
    9          <sch:report test="substring(./@key, 1, 2) = 'pn'"><sch:value-of select="./@reg" /> correctly has a key of "<sch:value-of select="./@key" />"</sch:report>
   10       </sch:rule>
   11    </sch:pattern>
   12    
   13    <sch:pattern name="All name elements that aren't for people must have a key begining with name.">
   14       <sch:rule context="/TEI.2/text//name[@type!='person']">
   15          <sch:assert test="substring(./@key, 1, 4) = 'name'">All keys for names, other than people names, must begin with "name".</sch:assert>
   16          <sch:report test="substring(./@key, 1, 4) = 'name'"><sch:value-of select="./@reg"/> correctly has a key of "<sch:value-of select="./@key"/>"</sch:report>
   17       </sch:rule>
   18    </sch:pattern>
   19    
   20    <sch:pattern name="Editor should be represented in a respStmt element.">
   21       <sch:rule context="/TEI.2/teiHeader/fileDesc">
   22          <sch:assert test=".//editor = .//respStmt/name">Editor "<sch:value-of select=".//editor"/>" must be represented in a respStmt's name element.</sch:assert>
   23          <sch:report test=".//editor = .//respStmt/name">Editor "<sch:value-of select=".//editor"/>" is represented in a respStmt's name element.</sch:report>
   24       </sch:rule>
   25    </sch:pattern>
   26    
   27    <sch:pattern name="All note references must refer to a real note">
   28       <sch:rule context="/TEI.2/text/body//ref">
   29          <sch:assert test="id(@target) and name(id(@target)) = 'note'">Note reference with id: "<sch:value-of select="./@id"/>" refers to note: "<sch:value-of select="./@target" />" that does not exist.</sch:assert>
   30          <sch:report test="id(@target) and name(id(@target)) = 'note'">Note reference with id: "<sch:value-of select="./@id"/>" refers to note: "<sch:value-of select="./@target" />"</sch:report>
   31       </sch:rule>
   32    </sch:pattern>
   33    
   34    <sch:pattern name="All notes must have a reference">
   35       <sch:rule context="/TEI.2/text/back/div1[@type='notes']/note">
   36          <sch:assert test="idref(@id)">Note with id: "<sch:value-of select="./@id"/>" is never refered to.</sch:assert>
   37          <sch:report test="idref(@id)">Note with id: "<sch:value-of select="./@id"/>" is refered to in reference: "<sch:value-of select="./@target"/>"</sch:report>
   38       </sch:rule>
   39    </sch:pattern>
   40    
   41    <sch:pattern name="All page break id must start with the text id.">
   42       <sch:rule context="/TEI.2/text">
   43          <sch:report test="./@id">The text id is: "<sch:value-of select="./@id" />"</sch:report>
   44          <sch:assert test=".//pb[substring(@id, 1, 8) = current()/@id]">All page breaks must have an id that begins with the text id.</sch:assert>
   45       </sch:rule>
   46    </sch:pattern>
   47    
   48 </sch:schema>
   49