docbook-apps

Replace straight apostrophe with curly apostrophe

  • 1.  Replace straight apostrophe with curly apostrophe

    Posted 02-18-2010 16:36
    Hello list,

    After a long discussion in XEP-support mailing list I still have a problem for replacing straight apostrophe with curly apostrophe.

    I my custom stylesheet I've put:

    <xsl:param name="singlequote">
    <xsl:text>'</xsl:text>
    </xsl:param>
    <xsl:param name="curlyquote">
    <xsl:text>’</xsl:text>
    </xsl:param>

    <xsl:template match="d:para//text()|d:title//text()">
    <xsl:value-of select="translate(.,$singlequote,$curlyquote)"/>
    </xsl:template>

    With this configuration all the straight apostrophe are changed into curly apostrophe. But it's ok for me. I would like to keep straight apostrophe for <litteral>, <computeroutput> or <screen> tags.

    During my tests I've change the stylesheet by (no more double slash):

    <xsl:template match="d:para/text()|d:title/text()">
    <xsl:value-of select="translate(.,$singlequote,$curlyquote)"/>
    </xsl:template>

    And it works well for text, title and screen (litteral and computer output too) but it failed on <xref>.

    In fact I could have in my text something like that:

    See <xref linkend="alice_home_dir">.



    ....


    I suppose that because the <xref linkend> reside before the title. But in fact the replacement is not made in the figure's title too.

    So for resuming how can I change the straight apostrophe into curly apostrophe every where except inside <computeroutput>, <litteral> and <screen> tags ?

    Thanks in advance,
    Jacques