Enforcing the use of U+2019 instead of the straight apostrophe
Posted by mholmes on 22 Jun 2012 in Activity log
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>