<?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 2019-07-16T15:14:01Z 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="teix" uri="http://www.tei-c.org/ns/Examples"/>

   <!-- ***** -->
   <!-- keys: -->
   <!-- ***** -->
   <key xmlns="http://www.w3.org/1999/XSL/Transform"
        name="idrefs"
        match="@target[starts-with(normalize-space(.), '#')]|@rendition[starts-with(normalize-space(.), '#')]"
        use="for $i in tokenize(., '\s+') return substring-after($i, '#')"/>

   <!-- ************ -->
   <!-- constraints: -->
   <!-- ************ -->
   <pattern id="schematron-constraint-tei_jtei-att.datable.w3c-att-datable-w3c-when-1">
      <rule context="tei:*[@when]">
        <report test="@notBefore|@notAfter|@from|@to" role="nonfatal">The @when attribute cannot be used with any other att.datable.w3c attributes.</report>
      </rule>
    </pattern>
   <pattern id="schematron-constraint-tei_jtei-att.datable.w3c-att-datable-w3c-from-2">
      <rule context="tei:*[@from]">
        <report test="@notBefore" role="nonfatal">The @from and @notBefore attributes cannot be used together.</report>
      </rule>
    </pattern>
   <pattern id="schematron-constraint-tei_jtei-att.datable.w3c-att-datable-w3c-to-3">
      <rule context="tei:*[@to]">
        <report test="@notAfter" role="nonfatal">The @to and @notAfter attributes cannot be used together.</report>
      </rule>
    </pattern>
   <pattern id="schematron-constraint-tei_jtei-att.typed-subtypeTyped-4">
      <rule context="tei:*[@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="schematron-constraint-tei_jtei-p-abstractModel-structure-p-5">
      <rule context="tei:p">
         <report test="not(ancestor::tei:floatingText) and (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 occur inside other paragraphs or ab elements.
      </report>
      </rule>
   </pattern>
   <pattern id="schematron-constraint-tei_jtei-p-abstractModel-structure-l-6">
      <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="schematron-constraint-tei_jtei-quote-jtei.sch-core-7">
                <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="schematron-constraint-tei_jtei-cit-jtei.sch-cit-8">
                <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="schematron-constraint-tei_jtei-desc-deprecationInfo-only-in-deprecated-9">
      <rule context="tei:desc[ @type eq 'deprecationInfo']">
	        <assert test="../@validUntil">Information about a
	deprecation should only be present in a specification element
	that is being deprecated: that is, only an element that has a
	@validUntil attribute should have a child &lt;desc
	type="deprecationInfo"&gt;.</assert>
      </rule>
    </pattern>
   <pattern id="schematron-constraint-tei_jtei-gap-jtei.sch-gap-10">
                <rule context="tei:gap">
                  <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="schematron-constraint-tei_jtei-gap-jtei.sch-gap-ws-11">
                <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="schematron-constraint-tei_jtei-ptr-jtei.sch-ptr-multipleTargets-12">
                <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="schematron-constraint-tei_jtei-ptr-ptrAtts-13">
      <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="schematron-constraint-tei_jtei-ref-jtei.sch-ref-multipleTargets-14">
                <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="schematron-constraint-tei_jtei-ref-jtei.sch-biblref-parentheses-15">
                <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="schematron-constraint-tei_jtei-ref-jtei.sch-biblref-target-16">
                <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="schematron-constraint-tei_jtei-ref-jtei.sch-biblref-type-17">
                <rule context="tei:ref[id(substring-after(@target, '#'))/self::tei:bibl]">
                  <assert xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
                 test="@type eq 'bibl'"
                 sqf:fix="bibltype.add">
                    A bibliographic reference must be typed as @type="bibl".
                  </assert>
                  
                </rule>
              </pattern>
   <pattern id="schematron-constraint-tei_jtei-ref-refAtts-18">
      <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="schematron-constraint-tei_jtei-list-gloss-list-must-have-labels-19">
      <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="schematron-constraint-tei_jtei-head-jtei.sch-head-number-20">
                <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="schematron-constraint-tei_jtei-head-jtei.sch-figure-head-21">
                <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="schematron-constraint-tei_jtei-note-jtei.sch-note-punctuation-22">
                <rule context="tei:note">
                  <assert test="not(following::text()[not(ancestor::tei:note)][1][matches(., '^[,\.:;!?\]]')])">
                    Footnotes should follow punctuation marks, not precede them. Place 
                    your &lt;<name/>&gt; element after the punctuation mark.
                  </assert>
                </rule>
                <rule context="tei:note">
                  <report test="preceding::text()[not(ancestor::tei:note)][1][matches(., '—$')]">
                    Footnotes should precede the dash, not follow it. Place 
                    your &lt;<name/>&gt; element before the dash.
                  </report>
                </rule>
                <rule context="tei:note" role="warning">
                  <report test="following::text()[not(ancestor::tei:note)][1][matches(normalize-space(), '^\)')]">
                    Footnotes may be placed before closing parentheses, though this is
                    exceptional. Please check if this note's placement is correct.
                    Otherwise, move it after the closing parenthesis.
                  </report>
                </rule>                
              <rule context="tei:note">
                  <assert role="warning" test="matches(normalize-space(), '[.?!]$')">
                    A footnote should end with closing punctuation.
                  </assert>
                </rule>
              </pattern>
   <pattern id="schematron-constraint-tei_jtei-note-jtei.sch-note-blocks-23">
                <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="schematron-constraint-tei_jtei-graphic-jtei.sch-graphic-dimensions-24">
                <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="schematron-constraint-tei_jtei-graphic-jtei.sch-graphic-context-25">
                <rule context="tei:graphic">
                  <assert test="parent::tei:figure">
                    <name/> may only occur inside figure.
                  </assert>
                </rule>
              </pattern>
   <pattern id="schematron-constraint-tei_jtei-author-jtei.sch-author-26">
                <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="schematron-constraint-tei_jtei-respStmt-jtei.sch-respSmt-27">
                <rule context="tei:respStmt">
                  <assert test="ancestor::tei:sourceDesc">
                    <name/> can only be used in the context of sourceDesc.
                  </assert>
                </rule>
              </pattern>
   <pattern id="schematron-constraint-tei_jtei-bibl-jtei.sch-bibl-id-28">
                <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="schematron-constraint-tei_jtei-bibl-jtei.sch-bibl-orphan-29">
                <rule context="tei:back/tei:div[@type eq 'bibliography']//tei:bibl"
            role="warning">
                  <assert test="key('idrefs', @xml:id)/parent::tei:ref[@type='bibl']">
                    This bibliographic entry is an orphan: no ref[@type="bibl"] references to it occur in the text.
                  </assert>
                </rule>
              </pattern>
   <pattern id="schematron-constraint-tei_jtei-bibl-jtei.sch-bibl-endpunctuation-30">
                <rule context="tei:back/tei:div[@type eq 'bibliography']//tei:bibl">
                  <assert role="warning" test="ends-with(normalize-space(), '.')">
                    A bibliographic entry should end with a period.
                  </assert>
                </rule>
              </pattern>
   <pattern id="schematron-constraint-tei_jtei-table-jtei.sch-table-31">
                <rule context="tei:table">
                  <assert test="not(ancestor::tei:list)">
                    No tables are are allowed inside lists.
                  </assert>
                </rule>
              </pattern>
   <pattern id="schematron-constraint-tei_jtei-titleStmt-jtei.sch-title-32">
                <rule context="tei:titleStmt">
                  <assert xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
                 test="tei:title[@type = 'main']"
                 sqf:fix="type.add">
                    A title of type "main" is required in <name/>.
                  </assert>
                                    
                </rule>
              </pattern>
   <pattern id="schematron-constraint-tei_jtei-idno-jtei.sch-doi-order-33">
                <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="schematron-constraint-tei_jtei-rendition-jtei.sch-rendition-34">
                <rule context="tei:rendition">
                  <assert test="key('idrefs', @xml:id) instance of attribute(rendition)">
                    Please remove all <name/> definitions that aren't actually being used in the article.
                  </assert>
                </rule>
              </pattern>
   <pattern id="schematron-constraint-tei_jtei-att-jtei.sch-att-35">
                <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="schematron-constraint-tei_jtei-tag-jtei.sch-tag-36">
                <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="schematron-constraint-tei_jtei-val-jtei.sch-att-37">
                <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="schematron-constraint-tei_jtei-text-jtei.sch-article-keywords-40">
                <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="schematron-constraint-tei_jtei-text-jtei.sch-article-abstract-41">
                <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="schematron-constraint-tei_jtei-text-jtei.sch-article-back-42">
                <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="schematron-constraint-tei_jtei-body-jtei.sch-body-43">
                <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="schematron-constraint-tei_jtei-div-jtei.sch-divtypes-front-44">
                <rule context="tei:div[@type = $div.types.front]">
                  <assert test="parent::tei:front">
                    A text division of type <value-of select="@type"/> may only occur inside front.
                  </assert>
                </rule>
              </pattern>
   <pattern id="schematron-constraint-tei_jtei-div-jtei.sch-divtypes-front2-45">
                <rule context="tei:front/tei:div">
                  <assert test="@type = $div.types.front">
                    Only text divisions of type <value-of select="string-join(for $i in $div.types.front return concat(if (index-of($div.types.front, $i) = count($div.types.front)) then 'or ' else (), '&#34;', $i, '&#34;'), ', ')"/> may appear in the &lt;front&gt;.
                  </assert>
                </rule>
              </pattern>
   <pattern id="schematron-constraint-tei_jtei-div-jtei.sch-divtypes-back-46">
                <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="schematron-constraint-tei_jtei-div-jtei.sch-divtypes-body-47">
                <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="schematron-constraint-tei_jtei-div-jtei.sch-div-head-48">
                <rule context="tei:body//tei:div[not(@type = ('editorialIntroduction'))]">
                  <assert test="tei:head">
                    A <name/> must contain a head.
                  </assert>
                </rule>
              </pattern>
   <pattern id="schematron-constraint-tei_jtei-div-abstractModel-structure-l-49">
      <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="schematron-constraint-tei_jtei-div-abstractModel-structure-p-50">
      <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="schematron-constraint-tei_jtei-front-jtei.sch-front-abstract-51">
                <rule context="tei:front">
                  <assert test="tei:div[@type='abstract']">
                    <name/> must have an abstract (div[@type='abstract']).
                  </assert>
                </rule>
              </pattern>
   <pattern id="schematron-constraint-tei_jtei-back-jtei.sch-back-52">
                <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="schematron-constraint-tei_jtei-supplied-jtei.sch-supplied-53">
                <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>
                <key xmlns="http://www.w3.org/1999/XSL/Transform"
           name="idrefs"
           match="@target[starts-with(normalize-space(.), '#')]|@rendition[starts-with(normalize-space(.), '#')]"
           use="for $i in tokenize(., '\s+') return substring-after($i, '#')"/>
                <let name="double.quotes" value="'[&#34;“”]'"/>
                <let name="apos.typographic" value="'[‘’]'"/>
                <let name="apos.straight" value="''''"/>
                <let name="quotes" value="concat('[', $apos.straight, '&#34;]')"/>
                <let name="div.types.front"
           value="('abstract', 'acknowledgements', 'authorNotes', 'editorNotes', 'corrections', 'dedication')"/>
                
                <let name="tei.version.url"
           value="'https://jenkins.tei-c.org/job/TEIP5/lastStableBuild/artifact/P5/release/doc/tei-p5-doc/VERSION'"/>
                <let name="tei.version"
           value="if (unparsed-text-available($tei.version.url)) then normalize-space(unparsed-text($tei.version.url)) else ()"/>
              </pattern>
            <pattern id="schematron-constraint-tei_jtei-jtei.sch-straightApos-56">
              <rule context="text()[not(ancestor::tei:eg|ancestor::eg:egXML|ancestor::tei:code|ancestor::tei:tag)]">
                <report xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
                 test="matches(., $apos.straight)"
                 sqf:fix="apostrophe.replace">
                  "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="schematron-constraint-tei_jtei-jtei.sch-LRquotes-57">
              <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="schematron-constraint-tei_jtei-jtei.sch-quotationMarks-58">
              <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="schematron-constraint-tei_jtei-jtei.sch-doubleHyphens-59">
              <rule context="text()[not(ancestor::tei:eg|ancestor::eg:egXML|ancestor::tei:code|ancestor::tei:tag|ancestor::tei:ref)]">
                <assert xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
                 test="not(contains(., '--'))"
                 sqf:fix="dash.replace">
                  Double hyphens should not be used for dashes. Please use 
                  the EM Dash (U+2014 or —) instead.
                </assert>
                
              </rule>
            </pattern>
   <pattern id="schematron-constraint-tei_jtei-jtei.sch-rangeHyphen-60">
              <rule context="text()[not(ancestor::tei:eg|ancestor::eg:egXML|ancestor::tei:code|ancestor::tei:tag|ancestor::tei:idno|ancestor::tei:date)]">
                <assert xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
                 test="not(matches(., '(^|[\W-[-]])\d+-\d+([\W-[-]]|$)'))"
                 sqf:fix="hyphen.replace">
                  Numeric ranges should not be indicated with a hyphen. Please use 
                  the EN Dash (U+2013 or –) character instead.
                </assert>
                
              </rule>
            </pattern>
   <pattern id="schematron-constraint-tei_jtei-jtei.sch-ieEg-61">
              <rule context="text()[not(ancestor::tei:eg|ancestor::eg:egXML|ancestor::tei:code|ancestor::tei:tag)]">
                <report xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
                 test="matches(., '(i\.e\.|e\.g\.)[^,]', 'i')"
                 sqf:fix="comma.add">
                  You should put a comma after "i.e." and "e.g.". 
                </report>
                
              </rule>
            </pattern>
   <pattern id="schematron-constraint-tei_jtei-jtei.sch-localLinkTarget-62">
              <rule context="@*[self::attribute(corresp)|self::attribute(target)|self::attribute(from)|self::attribute(to)|self::attribute(ref)|self::attribute(rendition)|self::attribute(resp)|self::attribute(source)][not(ancestor::eg:egXML)][some $i in tokenize(., '\s+') satisfies starts-with($i, '#')]">
                <let name="orphan.pointers"
              value="for $p in tokenize(., '\s+')[starts-with(., '#')] return if (not(id(substring-after($p, '#')))) then $p else ()"/>
                <report test="exists($orphan.pointers)">
                  There's no local target for <value-of select="if (count($orphan.pointers) &gt; 1) then 'these pointers' else 'this pointer'"/>: <value-of select="string-join($orphan.pointers, ', ')"/>. Please make sure you're referring to an existing @xml:id value.
                </report>
              </rule>
            </pattern>
   <pattern id="schematron-constraint-tei_jtei-jtei.sch-renditionTarget-63">
              <rule context="@rendition">
                <let name="orphan.pointers"
              value="for $p in tokenize(., '\s+')[starts-with(., '#')] return for $id in id(substring-after($p, '#'))[not(self::tei:rendition)] return $p"/>
                <report test="exists($orphan.pointers)">
                  <value-of select="if (count($orphan.pointers) &gt; 1) then 'These pointers don''t' else 'This pointer doesn''t'"/> point to a &lt;rendition&gt; target: <value-of select="string-join($orphan.pointers, ', ')"/>.
                </report>
              </rule>
            </pattern>
   <pattern id="schematron-constraint-tei_jtei-jtei.sch-quoteDelim-64">
              <rule context="tei:title[@level eq 'a']|tei:mentioned|tei:soCalled|tei:quote|tei:q">
                <assert xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
                 test="not(matches(., concat('^', $double.quotes, '|', $double.quotes, '$')))"
                 sqf:fix="quotation.remove">
                  Quotation mark delimiters are not allowed for <name/>: they are completed at processing time via XSLT.
                </assert>
                
              </rule>
            </pattern>
   <pattern id="schematron-constraint-tei_jtei-jtei.sch-crossref-id-65">
              <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="schematron-constraint-tei_jtei-jtei.sch-formalCrossref-66">
              <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="schematron-constraint-tei_jtei-jtei.sch-crossrefTargetType-67">
              <rule context="tei:ptr[@type='crossref']|tei:ref[@type='crossref']">
                <let name="orphan.pointers"
              value="for $p in tokenize(@target, '\s+')[starts-with(., '#')] return for $id in id(substring-after($p, '#'))[not(self::tei:div or self::tei:figure or self::tei:table or self::tei:note)] return $p"/>
                <report test="exists($orphan.pointers)">
                  Cross-links (<name/>[@type="crossref"]) should be targeted at div, figure, table, or note elements. The target of <value-of select="if (count($orphan.pointers) &gt; 1) then 'these pointers' else 'this pointer'"/> doesn't satisfy this condition: <value-of select="string-join($orphan.pointers, ', ')"/>.
                </report>
              </rule>
            </pattern>
   <pattern id="schematron-constraint-tei_jtei-jtei.sch-crossrefType-68">
              <rule context="tei:ptr[not(@type='crossref')]|tei:ref[not(@type='crossref')]">
                <report xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
                 test="id(substring-after(@target, '#'))/(self::tei:div|self::tei:figure|self::tei:table)"
                 sqf:fix="crossreftype.add">
                  Please type internal cross-references as 'crossref' (<name/>[@type="crossref"]).
                </report>
                
              </rule>
            </pattern>
   <pattern id="schematron-constraint-tei_jtei-jtei.sch-centuries-69">
              <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="schematron-constraint-tei_jtei-jtei.sch-teiVersion-70">
              <rule context="@target[matches(., '^https?://(www\.)?tei-c\.org/release/doc/tei-p5-doc')]">
                <assert xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
                 test="false()"
                 sqf:fix="teiURL.fix">
                  Please refer to the exact version of the TEI Guidelines<value-of select="if (normalize-space($tei.version)) then concat(' (currently at version ', $tei.version, ')') else ()"/>, and link to the version that can be found in the Vault section. For an overview of all archived versions, see https://www.tei-c.org/Vault/P5/.
                  
                  If you're referring to the English version, the correct URL will likely take the form of https://www.tei-c.org/Vault/P5/{$version-number}/doc/tei-p5-doc/en/html/.
                </assert>
                
              </rule>
            </pattern>
   <pattern id="schematron-constraint-tei_jtei-jtei.jtei-url-71">
              <rule context="@target[matches(., '^https?://(www\.)?jtei\.revues\.org/?')]"
            role="warning">
                <let name="URL.fixed"
              value="replace(., '^https?://(www\.)?jtei\.revues\.org/?', 'https://journals.openedition.org/jtei/')"/>
                <assert xmlns:sqf="http://www.schematron-quickfix.com/validator/process"
                 test="false()"
                 sqf:fix="jteiURL.fix">
                  Please refer to the correct jTEI URL: <value-of select="$URL.fixed"/>.
                </assert>
                
              </rule>
            </pattern>
</schema>
