<schema xmlns="http://www.ascc.net/xml/schematron">
  <!-- Schematron document to test constraints for global and local ITS markup.
 For ITS markup definitions, see http://www.w3.org/TR/its/ . -->
  <ns prefix="its" uri="http://www.w3.org/2005/11/its"/>
  <pattern name="Check ITS Global Rules and Local Constraints, and Version Constraints">
    <rule context="*">
      <!-- Tests for locNoteRule -->
      <report test="self::its:locNoteRule and child::its:locNote and @its:locNotePointer">
        locNoteRule error: A locNoteRule element must not have both a locNote child element and a
        locNotePointer attribute.</report>
      <report test="self::its:locNoteRule and @its:locNoteRef and @its:locNoteRefPointer">
        locNoteRule error: A locNoteRule element must not have both a locNoteRef attribute and a
        locNoteRefPointer attribute.</report>
      <report test="self::its:locNoteRule and child::its:locNote and @its:locNoteRef"> locNoteRule
        error: A locNoteRule element must not have both a locNote child element and a locNoteRef
        attribute.</report>
      <!-- Test for termRule -->
      <report test="self::its:termRule and @its:termInfoRef and @its:termInfoRefPointer"> termRule
        error: A termRule element must not have both a termInfoRef attribute and a
        termInfoRefPointer attribute.</report>
      <report test="self::its:termRule and @its:termInfo and @its:termInfoPointer"> termRule error:
        A termRule element must not have both a termInfo attribute and a termInfoPointer
        attribute.</report>
      <report test="self::its:termRule and @its:termInfoRef and @its:termInfoPointer"> termRule
        error: A termRule element must not have both a termInfoRef attribute and a termInfoPointer
        attribute.</report>
      <!-- Test for rubyRule -->
      <report test="self::its:rubyRule and child::its:rubyText and @its:rtPointer"> rubyRule error:
        A rubyRule element must not have both a rubyText child element and a rtPointer
        attribute.</report>
      <!-- Test for locNote (local) -->
      <report test="@its:locNote and @its:locNoteRef"> Local ITS usage error: The locNote attribute
        and the locNoteRef attribute must not be used together.</report>
      <!-- Test for term (local) -->
      <report test="@its:termInfoRef and not(its:term) and not(self::its:termRule)"> Local ITS usage
        error: A termInfoRef attribute must not appear locally without a term attribute.</report>
      <!-- Version attribute test -->
      <report test="/*/@its:version != @its:version"> The version attribute at the root element and
        at the rules element must not specify different versions of ITS.</report>
    </rule>
  </pattern>
</schema>