[tei-council] review of IM

Syd Bauman Syd_Bauman at Brown.edu
Mon Oct 29 16:45:04 EST 2007


[originally sent 2007-10-28 15:03 -0400]

<div xml:id="IM-Schematron">
  <head>Extracting Schematron Rules</head>
  <p>Schematron patterns may be inserted into an ODD file. These
  patterns are typically used to test for conditions required by the
  encoding scheme being described, but which could otherwise not be
  expressed in a formal, validatable set of rules derived directly
  from the TEI ODD specifications themselves.</p>

  <p>For example, formally the TEI <gi>delSpan</gi> element, as a
  member of the class <name type="class">att.spanning</name>, may bear
  the <att>spanTo</att> attribute. That is, according to the schema,
  the attribute is optional. However, according to the encoding
  scheme, <att>spanTo</att> is required. To allow for formal
  validation of this extra constraint, a Schematron pattern like the
  following may be specified within the <gi>elementSpec</gi> for
  <gi>delSpan</gi>.
  <egXML xmlns:s="http://www.ascc.net/xml/schematron" xmlns="http://www.tei-c.org/ns/Examples">
    <s:pattern name="spanTo_required" xmlns:s="http://www.ascc.net/xml/schematron">
      <s:rule context="tei:delSpan">
        <s:assert test="@spanTo">The spanTo= attribute of <s:name/> is required.</s:assert>
      </s:rule>
    </s:pattern>
  </egXML></p>
  <p>Such a pattern should generally be placed inside the
  <gi>content</gi> or <gi>attDef</gi> of the specification to which it
  most closely applies.</p>
  <p>An ODD processor may extract these patterns and place them in a
  separate Schematron schema file. This schema can then be used to
  perform further formal tests for validity on instance files.</p>
  <p>For example, if the previous example Schematron pattern were the only one present in an
  complete ODD specification, an ODD processor might generate the following Schematron schema.
  <egXML xmlns:s="http://www.ascc.net/xml/schematron" xmlns="http://www.tei-c.org/ns/Examples">
<schema xmlns="http://www.ascc.net/xml/schematron"
  xmlns:rng="http://relaxng.org/ns/structure/1.0"
  xmlns:tei="http://www.tei-c.org/ns/1.0">

  <title>Extracted Schematron Patterns</title>
  <ns prefix="tei" uri="http://www.tei-c.org/ns/1.0"/>
  <ns prefix="rng" uri="http://relaxng.org/ns/structure/1.0"/>

  <pattern xmlns:tei="http://www.tei-c.org/ns/1.0" name="spanTo_required">
    <rule context="tei:delSpan">
      <assert test="@spanTo">The spanTo= attribute of <name/> is required.</assert>
    </rule>
  </pattern>

</schema></egXML>
  </p>
</div>



More information about the tei-council mailing list