Re: Spec DTD

There are two customisations I would like to migrate from the XSLT spec area to use in the other specs:

(a) the ability to have a <var> element inside <code> for italicized code.

xsltspec.dtd lines 55-57

<!-- Allow a 'code' element to contain a 'var' element for italicised code -->

<!ELEMENT code (%tech.pcd.mix;|var)*>

Seen for example in section 6.5 of the XSLT spec.

(b) Custom rendering of <var> elements.

xslt.xsl lines 443-459

  <xsl:template match="var[matches(., '[A-Z][0-9]')]">
    <var>
      <xsl:value-of select="substring(., 1, 1)"/>
      <sub><xsl:value-of select="substring(., 2, 1)"/></sub>
    </var>
  </xsl:template>
  
  <xsl:template match="var[contains(., '/')]">
    <var>
      <xsl:value-of select="substring-before(., '/')"/>
      <sub><xsl:value-of select="substring-after(., '/')"/></sub>
    </var>
  </xsl:template>

  <xsl:template match="var[matches(., '[A-Z]''')]">
    <var><xsl:value-of select="translate(., '''', '&#x2032;')"/></var>
  </xsl:template>  

Allowing <var>A1</var> for A subscript 1, <var>A/i</var for A subscript i, and <var>A'</var> for A prime.

Seen for example in section 3.5.1 of the XSLT spec.

Any objections?

Section 2.5.6 of the XPath spec, for example, would benefit from similar treatment.

Michael Kay
Saxonica

Received on Sunday, 9 October 2022 17:21:41 UTC