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

From: G. Ken Holman <gkholman@CraneSoftwrights.com>
Date: Mon Feb 15 2010 - 09:07:21 PST

At 2010-02-15 16:39 +0100, Jacques Foucry wrote:
>Hello folks,
>
>I came back to this topic because I found a new issue (i think I've
>already the explanation, but I want your opinion.
>
>On 18 janv. 2010, at 00:20, G. Ken Holman wrote:
> > Alternatively:
> >
> > <xsl:template match="computeroutput//text() | literal//text()">
> > ...just for the descendent text nodes...
> > </xsl:template>
>
>In my Custom Stylesheet I've put that :

No, you haven't put what I suggested in your stylesheet.

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

Why do you have "d:para/text()" when I suggested the equivalent of
"d:para//text()"?

>Some where else, I redefine the generated text for figure link :
>
> <l:context name="xref-number-and-title">
> <l:template name="figure-jf" text="figure&#160;%n"/>
> <l:template name="chapter" text="Chapitre %n, %t"/>
> </l:context>
>
>And in my XML Docbook file I have something like that :
>
><para>As you can see on <xref linkend="fig-1"/>
><figure xml:id="fig-1>
> <title>From Alice's home directory</title>
> ...
></figure>

Yes, your single quote in "Alice's" is a descendant of para, not a
child of para. In my example for you I specifically indicated that
the match template was for the descendants of the ancestral element,
not the children of the ancestral element.

>In the figure legend the straight quote is change into curly quote
>but not in the reference.

Exactly, because you did not match a text node that is a descendant
of the paragraph, only a child of the paragraph. The figure's
title's text node is a descendant. What you see is what I would
expect from the code you implemented, but is not what I would expect
from the code that I suggested.

>I suppose it because the <xref> is resolve before the template is
>applied to <title>.

Not at all.

>Is there a solution to solve this issue, except moving the <xref>
>after the figure ?

Yes, implement my suggestion as I suggested it, without changing it
to be a subset of what I suggested.

Of course I realize it is a simple oversight, but nevertheless it is
an important one that changes the behaviour totally. I can see in
your quotation of my suggestion I was very careful to use "//"
instead of "/" ... if you recall from Kevin's post he specifically
cited ancestors, not parent, thus requiring my use of descendants and
not children.

I hope this helps.

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

--
XSLT/XQuery/XPath training after http://XMLPrague.cz 2010-03-15/19
XSLT/XQuery/XPath training:   San Carlos, California 2010-04-26/30
Vote for your XML training:   http://www.CraneSoftwrights.com/f/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/f/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@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@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 Mon Feb 15 09:52:13 2010

This archive was generated by hypermail 2.1.8 : Mon Feb 15 2010 - 09:52:14 PST