TEIC / atop

Another TEI ODD Processor
Other
9 stars 2 forks source link

We appear to be copying a TEI element to the RNG output #27

Closed martindholmes closed 2 months ago

martindholmes commented 2 months ago

This template from the transpile.xslt:

  <xsl:template match="moduleRef[@url]/content" as="element(content)">
    <xsl:variable name="vInclusion" as="node()">
      <xsl:apply-templates mode="atop:rngCombine" select="doc(../@url)"/>
    </xsl:variable>
    <xsl:copy>
      <xsl:sequence select="@*"/>
      <xsl:apply-templates select="$vInclusion">
        <xsl:with-param name="tpPrefix" as="xs:string" select="../@prefix"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="node()"/>
    </xsl:copy>
  </xsl:template>

appears to copy the TEI content element which is a child of moduleRef to the RNG output. @HelenaSabel and I don't quite understand what's happening here. We need to determine if this is what's happening, and if so, what should happen instead; and we should have more tests for checking moduleRef handling at the transpile stage.

sydb commented 2 months ago

The only child of <moduleRef> is <content>, which is used to specify RELAX NG code that is also used in the output schema, in addition to the RELAX NG found in the <content> at the end of @url, if any. This template matches that <content>, and copies over both chunks of RELAX NG.

I suppose there is a worry that the <content> has not RELAX NG, but rather TEI descendants. (There are no extant cases of this in the entire atop/ or TEI/P5/ directories, but it could happen.)

We should either

  1. Leave code as is, add constraint to ploddSchemaSpecification.odd to limit this <content> to only RELAX NG children.
  2. Change code to check for <tei:*>, not copy it, and issue a warning instead.
  3. Leave code as is, if user puts <tei:*> in a <content> in a <moduleRef> the output schema will be broken without warning.

I like (1) the most and hate (3). I like (1) so much better, I just thought “why didn’t we already do that?” to myself and then checked. I discovered two things.

  1. There is no ploddSchemaSpecification.odd in our "main" branch.
  2. The ploddSchemaSpecification.odd schema (which is, appropriately, in "dev" branch) does have a constraint that limits the content of /tei:moduleRef/tei:content to RELAX NG (either <rng:*> or <a:*>).
sydb commented 2 months ago

HOWEVER, that constraint ("only_rng_in_moduleRef_content") does not have an <sch:rule>, which it now needs. Probably true of other constraint specifications in that schema …

martindholmes commented 2 months ago

Issue is not an issue, and tangential fix applied.