[tei-council] where to put schematron constraints

Syd Bauman Syd_Bauman at Brown.edu
Fri Jun 20 03:04:50 EDT 2008


DS> I'd ask two questions, if polling the constituency:
DS> * Have you used Schematron inside of an ODD file?
DS> * Do you use independent Schematron schemas to validate TEI files?
DS> I'd guess quite a few more of us would answer "yes" to #2, but
DS> might well try #1 if the mechanism is simple.

I agree. And the easy way to make it somewhat simpler, of course, is
to add "Schematron" to the possible types of schemas that can be
obtained from Roma the web tool. It can't just be listed in the
pop-up menu, though, as that would imply that the Schematron rules
you get are somehow equivalent to the RELAX NG schema you get.

My gut instinct is the right way to do this is either with multiple
submission buttons or with radio buttons, so that an explanation can
be associated with each schema language. This would permit something
like:

   __ RELAX NG, XML syntax (canonical)
   __ RELAX NG, compact syntax (canonical)
   __ W3C Schema (non-canonical, but expresses almost exactly the
      same set of constraints)
   __ DTD (expresses only a subset of the constraints available in
      RELAX NG, and thus only recommended if you are using tools that
      cannot make use of RELAX NG)
   __ Schematron (extracts Schematron constraints that are entirely
      separate from the constraints expressed in the languages above)


On the issue where to put the Schematron constraints, while I
consider permitting them as a direct child of <elementSpec> better
than as a child of <content>, it still seems like we would be
constraining their location in a manner that misses the point of an
ODD: to be able to associate the documentation with the formal
constraint. 

Seems to me one should be able to put Schematron rules into
<macroSpec>, too, and that something like the following should be
possible. 
--------- begin example ---------
<elementSpec ident="div" mode="change">
  <desc>Just a little demo of how Schematron might be embedded into
             ODD code</desc>
  <attList>
    <attDef ident="type">
      <datatype minOccurs="1" maxOccurs="1">
        <rng:ref name="data.enumerated"/>
      </datatype>
      <valList type="closed">
        <valItem ident="foreword">
          <desc>Introductory text written by someone other than the
          author</desc>
          <s:pattern name="foreword only in front matter">
            <s:rule context="tei:div[@type='foreword']">
              <s:assert test="parent::tei:front">
                forewords (i.e., 'div' elements with type="foreword")
                should be children of the front matter
              </s:assert>
            </s:rule>
          </s:pattern>
        </valItem>
        <valItem ident="preface">
          <desc>Introductory text written by the author</desc>
          <s:pattern name="preface only in front matter">
            <s:rule context="tei:div[@type='preface']">
              <s:assert test="parent::tei:front">
                prefaces (i.e., 'div' elements with type="preface")
                should be children of the front matter
              </s:assert>
            </s:rule>
          </s:pattern>
        </valItem>
        <!-- ... -->
      </valList>
    </attDef>
  </attList>
</elementSpec>
--------- end example ---------

One can well imagine an ODD processor that made use of this somehow.
E.g., putting the relevant Schematron code in a note that pops up
when the user moses over the attribute name in the customized
documentation. That sort of thing.



More information about the tei-council mailing list