TEIC / TEI

The Text Encoding Initiative Guidelines
https://www.tei-c.org
Other
269 stars 88 forks source link

constraints on `<dataFacet>` and `@restriction` should be explicit #2326

Closed sydb closed 1 year ago

sydb commented 1 year ago

Should have Schematron to enforce <dataFacet> or @restriction can occur iff @name, as the remarks in the dataRef tagdoc make clear.

(Note that #1744 may have some bearing on this, but it will take a long time, and thus should not stop us from an explicit constraint on the current system.)

sydb commented 1 year ago

Actually, the work is already done, but it is internally inconsistent. Here are the three constraint specifications from dataFacet.xml.

restrictDataFacet:

<sch:rule context="tei:dataRef[tei:dataFacet]">
  <sch:assert test="@name" role="nonfatal">Data facets can only be specified for references to datatypes specified by
    XML Schemas: Part 2: Datatypes</sch:assert>
</sch:rule>

restrictAttRestriction:

<sch:rule context="tei:dataRef[tei:dataFacet]">
  <sch:report test="@restriction" role="nonfatal">The attribute restriction cannot be used when dataFacet elements are present.</sch:report>
</sch:rule>

restrictAttResctrictionName:

<sch:rule context="tei:dataRef">
  <sch:report test="@restriction and not(@name)" role="fatal">The attribute restriction can only be used with a name attribute.</sch:report>
</sch:rule>
  1. The first two are nonfatal, but the third is fatal.
  2. They each test three conditions. However, the first two test two conditions in the @context and one in @test; the third tests one condition in the @context and two in the @test.
  3. The message for the first (“restrictDataFacet”) and third (“restrictAttResctrictionName”) describe the same condition (that the <dataRef> specify an XSD datatype by use of @name), but in the first case describes it by the kind of datatype referred to (XSD), and in the third by the attribute used to refer to it (@name).