<?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 2018-09-08T18:53:35Z 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 uri="http://www.tei-c.org/ns/1.0" prefix="tei"/>

   <!-- ********************* -->
   <!-- namespaces, implicit: -->
   <!-- ********************* -->
   <ns prefix="rng" uri="http://relaxng.org/ns/structure/1.0"/>

   <!-- ************ -->
   <!-- constraints: -->
   <!-- ************ -->
   <pattern id="schematron-constraint-bptl-L1-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-bptl-L1-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-bptl-L1-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-bptl-L1-att.datable-calendar-calendar-4">
          <rule context="tei:*[@calendar]">
            <assert test="string-length(.) gt 0">
@calendar indicates the system or calendar to which the date represented by the content of this element
belongs, but this <name/> element has no textual content.</assert>
          </rule>
        </pattern>
   <pattern id="schematron-constraint-bptl-L1-att.typed-subtypeTyped-5">
      <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-bptl-L1-att.styleDef-schemeVersion-schemeVersionRequiresScheme-6">
          <rule context="tei:*[@schemeVersion]">
            <assert test="@scheme and not(@scheme = 'free')">
              @schemeVersion can only be used if @scheme is specified.
            </assert>
          </rule>
        </pattern>
   <pattern id="schematron-constraint-bptl-L1-p-abstractModel-structure-p-7">
      <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-bptl-L1-p-abstractModel-structure-l-8">
      <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-bptl-L1-ptr-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="schematron-constraint-bptl-L1-ref-refAtts-10">
      <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-bptl-L1-list-gloss-list-must-have-labels-11">
      <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-bptl-L1-title-level-titleLevel-12">
                    <rule context="tei:fileDesc/tei:titleStmt/tei:title">
                      <report test="@level">The @level attribute
                      should not be specified on a &lt;title&gt; within the
                      &lt;titleStmt&gt;.</report>
                    </rule>
                    <rule context="tei:title[parent::tei:seriesStmt]">
                      <assert test="@level='s'">When a child of
                      &lt;seriesStmt&gt;, the level of a title should be
                      specified as 's'.</assert>
                    </rule>
                    <rule context="tei:title[ancestor::tei:series]">
                      <assert test="@level='s'">When inside the
                      series-level portion of a structured bibliographic
                      citation, the level of a title should be specified
                      as 's'.</assert>
                    </rule>
                    <rule context="tei:title[parent::tei:analytic]">
                      <assert test="@level='a'">When a child of
                      &lt;analytic&gt;, the level of a title should be
                      specified as 'a'.</assert>
                    </rule>
                    <rule context="tei:title[parent::tei:monogr]">
                      <report test="@level='a'">When a child of
                      &lt;monogr&gt;, the level of a title should not be
                      specified as 'a'.</report>
                    </rule>
                  </pattern>
   <pattern id="schematron-constraint-bptl-L1-title-type-titleType-13">
                    <rule context="tei:titleStmt/tei:title">
                      <assert test="@type">Inside the title statment the
                      @type of a &lt;title&gt; should be specified</assert>
                    </rule>
                    <rule context="tei:monogr/tei:title">
                      <assert test="@type">Inside a structured
                      bibliographic citation of a mongraphic-level item,
                      @type of a &lt;title&gt; should be specified</assert>
                    </rule>
                    <rule context="tei:analytic/tei:title">
                      <assert test="@type">Inside the analytic portion
                      of a structured bibliographic citation, @type of a
                      &lt;title&gt; should be specified</assert>
                    </rule>
                  </pattern>
      
      
    
      
    <pattern id="schematron-constraint-bptl-L1-teiHeader-no-ab-inside-header-16">
      <rule context="tei:teiHeader">
                <report test=".//tei:ab">Use p instead of ab in the TEI header. (There are <value-of select="count(.//tei:ab)"/> ab elements in this header.)</report>
              </rule>
   </pattern>
   <pattern id="schematron-constraint-bptl-L1-publicationStmt-PubStmt-specialPreferred-17">
      <rule context="tei:publicationStmt">
                <report role="warning" test="child::tei:p">Use of
                specialized child elements of the publication
                statement (rather than paragraphs) is recommended
                whenever possible</report>
              </rule>
   </pattern>
   <pattern id="schematron-constraint-bptl-L1-publicationStmt-whenNotContent-18">
                <rule context="tei:publicationStmt/tei:date">
                  <assert test="@when">Dates inside the
                  publication statement should have @when
                  (and should not have content)</assert>
                  <report test="string-length(                                   normalize-space(.) ) &gt; 0">Dates
                  inside the publication statement should
                  not have content (and should have
                  @when)</report>
                </rule>
              </pattern>
   <pattern id="schematron-constraint-bptl-L1-quotation-quotationContents-19">
      <rule context="tei:quotation">
         <report test="not(@marks) and not (tei:p)">
On <name/>, either the @marks attribute should be used, or a paragraph of description provided</report>
      </rule>
   </pattern>
   <pattern id="schematron-constraint-bptl-L1-tagUsage-gi-numbered-vs-unnumbered-20">
                    <rule context="tei:text">
                      <report test=".//tei:div and .//tei:div1">
                        A single TEI in Libraries document should not mix numbered and unnumbered divisions.
                      </report>
                    </rule>
                    <rule context="/tei:TEI[ tei:text//tei:div or tei:text//tei:div1 ]">
                      <assert test="/tei:TEI/tei:teiHeader/tei:encodingDesc/tei:tagsDecl/tei:namespace/tei:tagUsage[ @gi = ('div','div1') ]">
                        The use of divisions (i.e., whether numbered or
                        unnumbered divisions are used) should be
                        documented in a &lt;tagUsage&gt; element by "Unnumbered divs used." or "Numbered divs used." The &lt;tagUsage&gt; element must be the child of
                        a &lt;namespace name="http://www.tei-c.org/ns/1.0"&gt; element.</assert>
                    </rule>
                    <rule context="/tei:TEI[ tei:sourceDoc and not( tei:text )]">
                      <assert test="/tei:TEI/tei:teiHeader/tei:encodingDesc/tei:tagsDecl/tei:namespace/tei:tagUsage[ @gi eq 'sourceDoc' ] ">
                        The fact that logical divisions are not encoded (and thus neither numbered nor unnumbered divisions are used) should be
                        documented in a &lt;tagUsage&gt; element by "Logical divisions not encoded." The &lt;tagUsage&gt; element must be the child of
                        a &lt;namespace name="http://www.tei-c.org/ns/1.0"&gt; element.</assert>
                    </rule>
                    <rule context="tei:tagUsage">
                      <assert test="                                 ( @gi eq 'div' and normalize-space(.) eq 'Unnumbered divs used.' and not( /tei:TEI/tei:text//tei:div1 ) )                                 or                                 ( @gi eq 'div1' and normalize-space(.) eq 'Numbered divs used.' and not( /tei:TEI/tei:text//tei:div ) )                                 or                                 ( @gi eq 'sourceDoc' and normalize-space(.) eq 'Logical divisions not encoded.' and not( /tei:TEI/tei:text//tei:div | /tei:TEI/tei:text//tei:div1 ) )                                 ">
                      A document that uses un-numbered divisions
                      should specify so by using &lt;tagUsage
                      gi="div"&gt;Unnumbered divs
                      used.&lt;/tagUsage&gt;; a document that uses
                      numbered divisions should specify so by using
                      &lt;tagUsage gi="div1"&gt;Numbered divs
                      used.&lt;/tagUsage&gt;; a document that uses
                      neither should specify so by using &lt;tagUsage
                      gi="sourceDoc"&gt;Logical divisions not
                      encoded.&lt;/tagUsage&gt;.
                      </assert>
                    </rule>
                  </pattern>
   <pattern id="schematron-constraint-bptl-L1-no-extent-in-fileDesc-21">
                <rule context="tei:fileDesc">
                  <report test="tei:extent">The &lt;extent&gt; element
                  should not be used as a direct child of
                  &lt;fileDesc&gt;, but rather only as a descendant of a
                  bibliographic citation (e.g., of the source).</report>
                </rule>
              </pattern>
   <pattern id="schematron-constraint-bptl-L1-when-or-before-after-22">
                <rule context="tei:imprint/tei:date">
                  <assert test="@when or ( @notBefore and @notAfter )">
                    When inside an &lt;imprint&gt;, a &lt;date&gt;
                    element should have a machine-readable version
                    of the date specified either on the @when
                    attribute, or, in the case of not knowing the
                    precise date, on the @notBefore and @notAfter
                  attributes.</assert>
                </rule>
              </pattern>
   <pattern id="schematron-constraint-bptl-L1-onlyAllowedAttrs-23">
                
                <rule context="tei:*/@*">
                  <assert test="name(.) = ('anchored', 'baseForm',                   'baseTypes', 'calendar', 'cause', 'cert', 'class',                   'cols', 'copyOf', 'corresp', 'degree', 'dur',                   'dur-iso', 'ed', 'end', 'eol', 'evaluate',                   'exclude', 'facs', 'from', 'from-iso', 'full', 'gi',                   'given', 'group', 'hand', 'height', 'ident', 'key',                   'level', 'locus', 'marks', 'met', 'min', 'n',                   'name', 'next', 'notAfter', 'notBefore', 'org',                   'part', 'period', 'place', 'precision', 'prev',                   'quantity', 'reason', 'ref', 'rend', 'render',                   'rendition', 'resp', 'rhyme', 'role', 'rows', 'sex',                   'scale', 'scheme', 'scope', 'select', 'sort',                   'subtype', 'synch', 'target', 'targetEnd',                   'targets', 'targFunc', 'to', 'to-iso', 'type',                   'unit', 'uri', 'url', 'usage', 'version', 'when',                   'who', 'width', 'lrx', 'lry', 'ulx', 'uly',                   'xml:base', 'xml:id', 'xml:lang', 'xml:space')">The
                  use of the <name/>= attribute (found here on the
                  &lt;<value-of select="local-name(..)"/>&gt;
                  element) is not recommended by the Best Practices
                  for TEI in Libraries</assert>
                </rule>
              </pattern>
</schema>
