<?xml version="1.0" encoding="utf-8"?>
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
   <title>ISO Schematron rules</title>
   <!-- This file generated 2015-10-15T19:59:18Z by 'extract-isosch.xsl'. -->

   <!-- ********************* -->
   <!-- namespaces, declared: -->
   <!-- ********************* -->
   <ns prefix="tei" uri="http://www.tei-c.org/ns/1.0"/>
   <ns prefix="xs" uri="http://www.w3.org/2001/XMLSchema"/>
   <ns prefix="rng" uri="http://relaxng.org/ns/structure/1.0"/>
   <ns prefix="sch" uri="http://purl.oclc.org/dsdl/schematron"/>
   <ns prefix="tei" uri="http://www.tei-c.org/ns/1.0"/>
   <ns prefix="xs" uri="http://www.w3.org/2001/XMLSchema"/>
   <ns prefix="eg" uri="http://www.tei-c.org/ns/Examples"/>

   <!-- ********************* -->
   <!-- namespaces, implicit: -->
   <!-- ********************* -->
   <ns prefix="tei" uri="http://www.tei-c.org/ns/1.0"/>
   <ns prefix="teix" uri="http://www.tei-c.org/ns/Examples"/>

   <!-- ************ -->
   <!-- constraints: -->
   <!-- ************ -->
   <pattern id="tei_jtei-att.typed-constraint-subtypeTyped-1">
      <rule context="*[@subtype]">
        <assert test="@type">The <name/> element should not be categorized in detail with @subtype
 unless also categorized in general with @type</assert>
      </rule>
    </pattern>
   <pattern id="tei_jtei-p-constraint-abstractModel-p-2">
      <rule context="tei:p">
         <report test="(ancestor::tei:p or ancestor::tei:ab)          and not(parent::tei:exemplum                |parent::tei:item                |parent::tei:note                |parent::tei:q                |parent::tei:quote                |parent::tei:remarks                |parent::tei:said                |parent::tei:sp                |parent::tei:stage                |parent::tei:cell                |parent::tei:figure)">
        Abstract model violation: Paragraphs may not contain other paragraphs or ab elements.
      </report>
      </rule>
   </pattern>
   <pattern id="tei_jtei-p-constraint-abstractModel-structure-l-3">
      <rule context="tei:p">
         <report test="ancestor::tei:l[not(.//tei:note//tei:p[. = current()])]">
        Abstract model violation: Lines may not contain higher-level structural elements such as div, p, or ab.
      </report>
      </rule>
   </pattern>
   <pattern id="tei_jtei-quote-constraint-jtei.sch-core-4">
                <rule context="tei:quote">
                  <assert test="id(substring-after(@source, '#'))/(self::tei:ref[@type eq 'bibl']|self::tei:bibl[ancestor::tei:body])">
                    <name/> must be accompanied by a bibliographic reference (ref[@type="bibl"]) or a bibliographic description in the running text.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-cit-constraint-jtei.sch-cit-5">
                <rule context="tei:cit" role="warning">
                  <assert test="tei:ref">
                    <name/> is normally expected to have a bibliographic reference (ref[@type="bibl"]). Please make sure you intended not to add one here.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-gap-constraint-jtei.sch-gap-6">
                <rule context="tei:gap-period">
                  <report test="following-sibling::node()[1][self::text()] and starts-with(following-sibling::node()[1], '.')">
                    A <name/> element should follow a period rather than precede it when an ellipsis follows the end of a sentence.
                  </report>
                </rule>
              </pattern>
   <pattern id="tei_jtei-gap-constraint-jtei.sch-gap-ws-7">
                <rule context="tei:gap">
                  <report test="preceding-sibling::node()[1][self::text()][matches(., '\.\s+$')]">
                    A <name/> should follow a period directly, without preceding whitespace.
                  </report>
                </rule>
              </pattern>
   <pattern id="tei_jtei-ptr-constraint-jtei.sch-ptr-multipleTargets-8">
                <rule context="tei:ptr[not(@type='crossref')]">
                  <report test="count(tokenize(normalize-space(@target), '\s+')) &gt; 1">
                    Multiple targets are only allowed for <name/>[@type='crossref'].
                  </report>
                </rule>
              </pattern>
   <pattern id="tei_jtei-ptr-constraint-ptrAtts-9">
      <rule context="tei:ptr">
         <report test="@target and @cRef">Only one of the
attributes @target and @cRef may be supplied on <name/>.</report>
      </rule>
   </pattern>
   <pattern id="tei_jtei-ref-constraint-jtei.sch-ref-multipleTargets-10">
                <rule context="tei:ref">
                  <report test="count(tokenize(normalize-space(@target), '\s+')) &gt; 1">
                    <name/> with multiple targets is not supported.
                  </report>
                </rule>
              </pattern>
   <pattern id="tei_jtei-ref-constraint-jtei.sch-biblref-parentheses-11">
                <rule context="tei:ref[@type eq 'bibl']">
                  <assert test="not(matches(., '^\(.*\)$'))">
                    Parentheses are not part of bibliographic references. Please move them out of <name/>.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-ref-constraint-jtei.sch-biblref-target-12">
                <rule context="tei:ref[@type eq 'bibl']">
                  <assert test="id(substring-after(@target, '#'))/(self::tei:bibl|self::tei:person[ancestor::tei:particDesc/parent::tei:profileDesc])">
                    A bibliographic reference must point to an entry in the bibliography.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-ref-constraint-jtei.sch-biblref-type-13">
                <rule context="tei:ref[id(substring-after(@target, '#'))/self::tei:bibl]">
                  <assert test="@type eq 'bibl'">
                    A bibliographic reference must be typed as @type="bibl".
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-ref-constraint-refAtts-14">
      <rule context="tei:ref">
         <report test="@target and @cRef">Only one of the
	attributes @target' and @cRef' may be supplied on <name/>
         </report>
      </rule>
   </pattern>
   <pattern id="tei_jtei-list-constraint-gloss-list-must-have-labels-15">
      <rule context="tei:list[@type='gloss']">
	        <assert test="tei:label">The content of a "gloss" list should include a sequence of one or more pairs of a label element followed by an item element</assert>
      </rule>
    </pattern>
   <pattern id="tei_jtei-head-constraint-jtei.sch-head-number-16">
                <rule context="tei:head">
                  <report test="matches(., '^\s*((figure|table|example|section) )?\d', 'i')">
                    Headings are numbered and labeled automatically, please remove the hard-coded label from the text.
                  </report>
                </rule>
              </pattern>
   <pattern id="tei_jtei-head-constraint-jtei.sch-figure-head-17">
                <rule context="tei:figure/tei:head">
                  <assert test="@type = ('legend', 'license')">
                    Figure titles must have a type 'legend' or 'license'.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-note-constraint-jtei.sch-note-18">
                <rule context="tei:note">
                  <assert test="not(following-sibling::text()[1][matches(., '^[,\.:;!?)\]]')])">
                    Footnotes should follow punctuation marks, not precede them. Place 
                    your &lt;note&gt; element after the punctuation mark.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-note-constraint-jtei.sch-note-blocks-19">
                <rule context="tei:note">
                  <report test=".//(tei:cit|tei:table|tei:list[not(tokenize(@rend, '\s+')[. eq 'inline'])]|tei:figure|eg:egXML|tei:eg)">
                    No block-level elements are allowed inside note.
                  </report>
                </rule>
              </pattern>
   <pattern id="tei_jtei-graphic-constraint-jtei.sch-graphic-dimensions-20">
                <rule context="tei:graphic">
                  <assert test="matches(@width, '\d+px') and matches(@height, '\d+px')">
                    Width and height in pixels must be specified for any <name/>.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-graphic-constraint-jtei.sch-graphic-context-21">
                <rule context="tei:graphic">
                  <assert test="parent::tei:figure">
                    <name/> may only occur inside figure.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-author-constraint-jtei.sch-author-22">
                <rule context="tei:titleStmt/tei:author">
                  <assert test="tei:name and tei:affiliation and tei:email">
                    Author information in the &lt;titleStmt&gt; must include &lt;name&gt;, &lt;affiliation&gt; and &lt;email&gt;.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-bibl-constraint-jtei.sch-bibl-id-23">
                <rule context="tei:back/tei:div[@type eq 'bibliography']//tei:bibl"
            role="warning">
                  <assert test="@xml:id">
                    A bibliographic entry should have a unique value for @xml:id.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-bibl-constraint-jtei.sch-bibl-orphan-24">
                <rule context="tei:back/tei:div[@type eq 'bibliography']//tei:bibl"
            role="warning">
                  <let name="currId" value="@xml:id"/>
                  <assert test="some $i in //tei:ref[@type='bibl'] satisfies tokenize($i/@target, '\s+')[replace(., '#', '') = $currId]">
                    This bibliographic entry is an orphan: no ref[@type="bibl"] references to it occur in the text.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-table-constraint-jtei.sch-table-25">
                <rule context="tei:table">
                  <assert test="not(ancestor::tei:list)">
                    No tables are are allowed inside lists.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-titleStmt-constraint-jtei.sch-title-26">
                <rule context="tei:titleStmt">
                  <assert test="tei:title[@type = 'main']">
                    A title of type "main" is required in <name/>.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-idno-constraint-jtei.sch-doi-order-27">
                <rule context="tei:back/tei:div[@type eq 'bibliography']//tei:idno[@type eq 'doi']">
                  <report test="following-sibling::tei:ref">
                    If a bibliographic entry has a formal DOI code, it should be placed at the very end of the bibliographic description.
                  </report>
                </rule>
              </pattern>
   <pattern id="tei_jtei-rendition-constraint-jtei.sch-rendition-28">
                <rule context="tei:rendition">
                  <assert test="some $i in //@rendition satisfies tokenize($i, '\s+')[replace(., '#', '') = current()/@xml:id]">
                    Please remove all <name/> definitions that aren't actually being used in the article.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-att-constraint-jtei.sch-att-29">
                <rule context="tei:att">
                  <assert test="not(matches(., '^@'))">
                    Attribute delimiters are not allowed for <name/>: they are completed at processing time via XSLT.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-tag-constraint-jtei.sch-tag-30">
                <rule context="tei:tag">
                  <assert test="not(matches(., '^[&lt;!?-]|[&gt;/?\-]$'))">
                    Tag delimiters such as angle brackets and tag-closing slashes are not allowed for <name/>: they are completed at processing time via XSLT.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-val-constraint-jtei.sch-att-31">
                <rule context="tei:val">
                  <assert test="not(matches(., concat('^', $quotes, '|', $quotes, '$')))">
                    Attribute value delimiters are not allowed for <name/>: they are completed at processing time via XSLT.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-text-constraint-jtei.sch-article-keywords-34">
                <rule context="tei:text[not(tei:body/tei:div[@type = ('editorialIntroduction')])]">
                  <assert test="parent::tei:TEI/tei:teiHeader/tei:profileDesc/tei:textClass/tei:keywords">
                    An article must have a keyword list in the header.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-text-constraint-jtei.sch-article-abstract-35">
                <rule context="tei:text[not(tei:body/tei:div[@type = ('editorialIntroduction')])]">
                  <assert test="tei:front/tei:div[@type='abstract']">
                    An article must have a front section with an abstract.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-text-constraint-jtei.sch-article-back-36">
                <rule context="tei:text[not(tei:body/tei:div[@type = ('editorialIntroduction')])]">
                  <assert test="tei:back/tei:div[@type='bibliography']/tei:listBibl">
                    An article must have a back section with a bibliography.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-body-constraint-jtei.sch-body-37">
                <rule context="tei:body[child::tei:div[not(@type=('editorialIntroduction'))]]">
                  <assert test="count(child::tei:div) gt 1">
                    If <name/> contains a div, and that div is not an editorial introduction, then there should be 
                    more than one div. Rather than using only a single div, you may place the content directly
                    in the <name/> element.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-div-constraint-jtei.sch-divtypes-front-38">
                <rule context="tei:div[@type = ('abstract', 'acknowledgements')]">
                  <assert test="parent::tei:front">
                    Abstracts (<name/>[@type="abstract"]) and acknowledgements (<name/>[@type="acknowledgements"]) may only occur inside front.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-div-constraint-jtei.sch-divtypes-front2-39">
                <rule context="tei:front/tei:div">
                  <assert test="@type=('abstract', 'acknowledgements')">
                    Only abstracts (div[@type="abstract"]) and acknowledgements (div[@type="acknowledgements"]) may appear in the &lt;front&gt;.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-div-constraint-jtei.sch-divtypes-back-40">
                <rule context="tei:div[@type = ('bibliography', 'appendix')]">
                  <assert test="parent::tei:back">
                    Bibliography (<name/>[@type="bibliography"]) and appendices (<name/>[@type="appendix"]) may only occur inside back.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-div-constraint-jtei.sch-divtypes-body-41">
                <rule context="tei:div[@type = ('editorialIntroduction')]">
                  <assert test="parent::tei:body">
                    An editorial introduction (<name/>[@type="editorialIntroduction"]) may only occur inside body.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-div-constraint-jtei.sch-div-head-42">
                <rule context="tei:div[not(@type = ('editorialIntroduction', 'bibliography', 'abstract', 'acknowledgements'))]">
                  <assert test="tei:head">
                    A <name/> must contain a head.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-div-constraint-abstractModel-structure-l-43">
      <rule context="tei:div">
         <report test="ancestor::tei:l">
        Abstract model violation: Lines may not contain higher-level structural elements such as div.
      </report>
      </rule>
   </pattern>
   <pattern id="tei_jtei-div-constraint-abstractModel-structure-p-44">
      <rule context="tei:div">
         <report test="ancestor::tei:p or ancestor::tei:ab and not(ancestor::tei:floatingText)">
        Abstract model violation: p and ab may not contain higher-level structural elements such as div.
      </report>
      </rule>
   </pattern>
   <pattern id="tei_jtei-front-constraint-jtei.sch-front-abstract-45">
                <rule context="tei:front">
                  <assert test="tei:div[@type='abstract']">
                    <name/> must have an abstract (div[@type='abstract']).
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-back-constraint-jtei.sch-back-46">
                <rule context="tei:back">
                  <assert test="tei:div[@type='bibliography']/tei:listBibl">
                    <name/> must have a bibliography (div[@type="bibliography"]), which must be organized inside a listBibl element.
                  </assert>
                </rule>
              </pattern>
   <pattern id="tei_jtei-supplied-constraint-jtei.sch-supplied-47">
                <rule context="tei:supplied">
                  <assert test="not(matches(., '^\[|\]$'))">
                    Please remove square brackets from <name/>: they are completed at processing time via XSLT.
                  </assert>
                </rule>
              </pattern>
              <pattern>
                <let name="double.quotes" value="'[&#34;“”]'"/>
                <let name="apos.typographic" value="'[‘’]'"/>
                <let name="apos.straight" value="''''"/>
                <let name="quotes" value="concat('[', $apos.straight, '&#34;]')"/>
              </pattern>
            <pattern id="tei_jtei-constraint-jtei.sch-straightApos-50">
              <rule context="text()[not(ancestor::tei:eg|ancestor::eg:egXML|ancestor::tei:code|ancestor::tei:tag)]">
                <report test="matches(., $apos.straight)">
                  "Straight apostrophe" characters are not permitted. Please use the
                  Right Single Quotation Mark (U+2019 or ’) character instead. On the other hand, if the straight 
                  apostrophe characters function as quotation marks, please replace them with appropriate mark-up 
                  that will ensure the appropriate quotation marks will be generated consistently.
                </report>
              </rule>
            </pattern>
   <pattern id="tei_jtei-constraint-jtei.sch-LRquotes-51">
              <rule context="text()[not(ancestor::tei:eg|ancestor::eg:egXML|ancestor::tei:code|ancestor::tei:tag)][matches(., $apos.typographic)]">
                <report test="matches(., '\W[’]\D') or matches(., '[‘](\W|$)') or matches(., '\w[‘]\w')">
                  Left and Right Single Quotation Marks should be used in the right place.
                </report>
              </rule>
            </pattern>
   <pattern id="tei_jtei-constraint-jtei.sch-quotationMarks-52">
              <rule context="text()[not(ancestor::tei:eg|ancestor::eg:egXML|ancestor::tei:code|ancestor::tei:tag)]">
                <report test="matches(., $double.quotes) or matches(., '(^|\W)[‘][^‘’]+[’](\W|$)')">
                  Quotation marks are not permitted in plain text. Please use appropriate mark-up that will ensure the appropriate quotation marks will be generated consistently.
                </report>
              </rule>
            </pattern>
   <pattern id="tei_jtei-constraint-jtei.sch-doubleHyphens-53">
              <rule context="text()[not(ancestor::tei:eg|ancestor::eg:egXML|ancestor::tei:code|ancestor::tei:tag|ancestor::tei:ref)]">
                <assert test="not(contains(., '--'))">
                  Double hyphens should not be used for dashes. Please use 
                  the EM Dash (U+2014 or —) instead.
                </assert>
              </rule>
            </pattern>
   <pattern id="tei_jtei-constraint-jtei.sch-rangeHyphen-54">
              <rule context="text()[not(ancestor::tei:eg|ancestor::eg:egXML|ancestor::tei:code|ancestor::tei:tag|ancestor::tei:idno)][not(. = parent::*/@*)]">
                <assert test="not(matches(., '\d-\d'))">
                  Numeric ranges should not be indicated with a hyphen. Please use 
                  the EN Dash (U+2013 or –) character instead.
                </assert>
              </rule>
            </pattern>
   <pattern id="tei_jtei-constraint-jtei.sch-ieEg-55">
              <rule context="text()[not(ancestor::tei:eg|ancestor::eg:egXML|ancestor::tei:code|ancestor::tei:tag)]">
                <report test="matches(., '(i\.e\.|e\.g\.)[^,]', 'i')">
                  You should put a comma after "i.e." and "e.g.". 
                </report>
              </rule>
            </pattern>
   <pattern id="tei_jtei-constraint-jtei.sch-localLinkTarget-56">
              <rule context="@*[not(ancestor::eg:egXML)][name() = ('corresp', 'target', 'from', 'to', 'ref', 'rendition', 'resp', 'source')][some $i in tokenize(., '\s+') satisfies starts-with($i, '#')]">
                <assert test="every $i in tokenize(., '\s+')[starts-with(., '#')] satisfies id( substring-after($i, '#'))">
                  There's no local target for this link. Please make sure you use an existing @xml:id value.
                </assert>
              </rule>
            </pattern>
   <pattern id="tei_jtei-constraint-jtei.sch-quoteDelim-57">
              <rule context="tei:title[@level eq 'a']|tei:mentioned|tei:soCalled|tei:quote|tei:q">
                <assert test="not(matches(., concat('^', $double.quotes, '|', $double.quotes, '$')))">
                  Quotation mark delimiters are not allowed for <name/>: they are completed at processing time via XSLT.
                </assert>
              </rule>
            </pattern>
   <pattern id="tei_jtei-constraint-jtei.sch-crossref-id-58">
              <rule context="tei:body//tei:div[not(@type='editorialIntroduction')]|tei:figure|tei:table"
            role="warning">
                <assert test="@xml:id">
                  You're strongly advised to add an @xml:id attribute to <name/> to ease formal cross-referencing 
                  with (ptr|ref)[@type='crossref']
                </assert>
              </rule>
            </pattern>
   <pattern id="tei_jtei-constraint-jtei.sch-formalCrossref-59">
              <rule context="text()[not(ancestor::tei:eg|ancestor::eg:egXML|ancestor::tei:code|ancestor::tei:tag|ancestor::tei:ref[not(@type='crossref')])]"
            role="warning">
                <assert test="not(matches(., '(table|figure|example|section) \d+([.,]\d+)* ((above)|(below))', 'i'))">
                  Please replace literal references to tables, figures, examples, and sections with a formal crosslink:
                  (ptr|ref)[@type="crossref"]
                </assert>
              </rule>
            </pattern>
   <pattern id="tei_jtei-constraint-jtei.sch-crossrefTargetType-60">
              <rule context="tei:ptr[@type='crossref']|tei:ref[@type='crossref']">
                <assert test="id(substring-after(@target, '#'))/(self::tei:div|self::tei:figure|self::tei:table)">
                  Cross-links (<name/>[@type="crossref"]) should be targeted at div, figure, or table elements.
                </assert>
              </rule>
            </pattern>
   <pattern id="tei_jtei-constraint-jtei.sch-crossrefType-61">
              <rule context="tei:ptr[not(@type='crossref')]|tei:ref[not(@type='crossref')]">
                <report test="id(substring-after(@target, '#'))/(self::tei:div|self::tei:figure|self::tei:table)">
                  Please type internal cross-references as 'crossref' (<name/>[@type="crossref"]).
                </report>
              </rule>
            </pattern>
   <pattern id="tei_jtei-constraint-jtei.sch-centuries-62">
              <rule context="text()[not(ancestor::tei:quote or ancestor::tei:title)]">
                <assert test="not(matches(., '\d\d?((th)|(st)|(rd)|(nd))[- ]centur((y)|(ies))', 'i'))">
                  Centuries such as "the nineteenth century" should be spelled out, not written with digits.
                </assert>
              </rule>
            </pattern>
   <pattern id="tei_jtei-constraint-jtei.sch-teiVersion-63">
              <rule context="@target[contains(., 'http://www.tei-c.org/release/doc/tei-p5-doc')]">
                <assert test="false()">
                  Please refer to the exact version of the TEI Guidelines, and link to the version that can be found in the Vault section. For an overview of all archived versions, see http://www.tei-c.org/Vault/P5/.
                  
                  If you're referring to the English version, the correct URL will likely take the form of http://www.tei-c.org/Vault/P5/{$version-number}/doc/tei-p5-doc/en/html/.
                </assert>
              </rule>
            </pattern>
</schema>
