Re: [xep-support] Replace straight apostrophe with curly apostrophe (again)

From: Jacques Foucry <jacques@foucry.net>
Date: Tue Sep 28 2010 - 02:15:05 PDT

On 27 sept. 2010, at 01:27, G. Ken Holman wrote:

Hello Ken,

> I suggest you create a very small example, the smallest you can make, that has a paragraph in it with the character that needs to be replaced. Run this through the XSLT processor only and not through the XSL-FO processor and you will be able to inspect the XSL-FO stream for any problems. You should see the character translated in the XSL-FO stream.

As you suggest I created a very small sample and a very small stylesheet file which do the job. Using xsltproc to see the XSLT processor flow.

In the result the only translated characters are those who are in <figure><title></title></figure>. The other are not translated.

In fact it seems it work for figure/title because I customize "formal.object.heading" template. If I remove this customization in my styleshhet
the quote are not translated.

Here is my stylesheet :

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
        xmlns:d="http://docbook.org/ns/docbook"
        xmlns:exsl="http://exslt.org/common"
        xmlns:fo="http://www.w3.org/1999/XSL/Format"
        exclude-result-prefixes="exsl d">
        
        <xsl:import href="file:/Volumes/Travaux/docbook-xsl/fo/profile-docbook.xsl"/>
        
        <xsl:param name="singlequote">
                <xsl:text>'</xsl:text>
        </xsl:param>
        <xsl:param name="curlyquote">
                <xsl:text>’</xsl:text>
        </xsl:param>
        
        
        <xsl:template name="formal.object.heading">
                <xsl:param name="object" select="."/>
                <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" text-align="center">
                        <xsl:apply-templates select="$object" mode="title.markup"/>
                </fo:block>
        </xsl:template>
        
        <xsl:template match="d:title//text()|d:para//text()" mode="no.anchor.mode">
                <xsl:value-of select="translate(.,$singlequote,$curlyquote)"/>
        </xsl:template>
</xsl:stylesheet>

And my little sample :

<?xml version="1.0" encoding="utf-8"?>
<chapter xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en">
        <title>Test 'as is'</title>
        <para>
                This software is provided 'as is'.
                <figure xml:id="test">
                        <title>This software is provided 'as is'</title>
                        <mediaobject>
                                <imageobject conformance="fo-xep">
                                        <imagedata fileref="images/warning.svg" align="center" format="svg" scalefit="1" width="75%"/>
                                </imageobject>
                        </mediaobject>
                </figure>
        </para>
</chapter>

Thanks in advance for your help

Best regards,
Jacques

-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo@renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/terms-of-service.html
Received on Tue Sep 28 02:46:02 2010

This archive was generated by hypermail 2.1.8 : Tue Sep 28 2010 - 02:46:11 PDT