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

G. Ken Holman gkholman at CraneSoftwrights.com
Tue Sep 28 05:55:45 PDT 2010


At 2010-09-28 11:15 +0200, Jacques Foucry wrote:
>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.

I'm using Saxon in my test below.

>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.

The match for quotes is in the "no.anchor.mode" 
mode, and I suspect your problem is that for the 
paragraph processing you are not in the correct mode.

In my example below I have removed the modes and 
the DocBook and it works file in Saxon ... if you 
try the example below with xsltproc and it works, 
then the issue is, I think, to do with the modes in play.

I hope this helps.

. . . . . . . . . . . Ken

t:\ftemp>type jacques.xml
<?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>

t:\ftemp>type jacques.xsl
<?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:template match="@*|node()"><!--identity for all other nodes-->
   <xsl:copy>
     <xsl:apply-templates select="@*|node()"/>
   </xsl:copy>
</xsl:template>

         <xsl:param name="singlequote">
                 <xsl:text>'</xsl:text>
         </xsl:param>
         <xsl:param name="curlyquote">
                 <xsl:text>GÇÖ</xsl:text>
         </xsl:param>

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

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



--
XSLT/XQuery training:   after http://XMLPrague.cz 2011-03-28/04-01
Vote for your XML training:   http://www.CraneSoftwrights.com/f/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/f/
G. Ken Holman                 mailto:gkholman at CraneSoftwrights.com
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/f/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal



-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo at 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



More information about the Xep-support mailing list