Enforcing the use of U+2019 instead of the straight apostrophe

22/06/12

Permalink 10:08:00 am, by mholmes, 180 words, 141 views   English (CA)
Categories: Activity log; Mins. worked: 120

Enforcing the use of U+2019 instead of the straight apostrophe

Wrote some XSLT to do the following:

  • Replace all instances of U+0027 in text() nodes with U+2019, following our editorial decision to that effect yesterday.
  • Transform old oxygen processing instructions to xml-model PIs for the RNG schema.
  • Add a PI pointing to the Schematron schema.

I've transformed all the documents with this, and validated them all. Flow has instructions for creating a Code Template in Oxygen to simplify typing of the U+2019 character. I've also added a constraint to the Schematron schema which enforces this.

The XSLT and Schematron were fiddly to get right because of the difficulties escaping the single-quote -- use-mention was hard to get around. For the record, these are the only approaches which seem to work (different for XSLT versus Schematron):

  <xsl:template match="text()">
    <xsl:value-of select="replace(., '''', '’')"/>
  </xsl:template>

    <rule context="text()">
      <assert test='not(contains(., "'"))'>
        "Straight apostrophe" characters are not permitted. Please use the 
        Right Single Quotation Mark (U+2019) character instead.
      </assert>
    </rule>

Pingbacks:

No Pingbacks for this post yet...

Map Of London

This project allows literary and scholarly works (primary and secondary) to be associated with locations in London, providing the reader with a richer understanding of the works.

Reports

May 2013
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

XML Feeds