xsl-list
[Top] [All Lists]

RE: RE: translate quote into quote quote

2005-12-11 23:36:29
Hi;

I do not know your code details but why don't you try replace("I'm sad that
I can't do it by myself"," ' "," ' ' "). (without spaces) Actually it
replaces all apostrophe with double apostrophe.

Cheers

-Daghan


-----Original Message-----
From: Philippe LAPLANCHE 
[mailto:philippe(_dot_)laplanche(_at_)horus-si(_dot_)com] 
Sent: Monday, 12 December 2005 5:30 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] RE: translate quote into quote quote

I fixed it :

<xsl:template name="escapeQuotes">
                <xsl:param name="string"/>
                <xsl:variable name="apos">'</xsl:variable>
                <xsl:if test="not(contains($string,$apos))"><xsl:value-of
select="$string"/></xsl:if>
                <xsl:if test="contains($string,$apos)"><xsl:value-of
select="substring-before($string,$apos)"/><xsl:value-of
select="$apos"/><xsl:value-of select="$apos"/><xsl:call-template
name="escapeQuotes"><xsl:with-param name="string"
select="substring-after($string,$apos)"/></xsl:call-template></xsl:if>
        </xsl:template>

Philippe


-----Message d'origine-----
De : Philippe LAPLANCHE 
Envoyé : lundi 12 décembre 2005 07:23
À : xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Objet : translate quote into quote quote

Hi, 
I need to translate a string such as this one :
I'm sad that I can't do it by myself
Into :
I''m sad that I can''t do it by myself

I'm using XSLT 1.0, and I tried to do something like that :

<xsl:template name="escapeQuotes">
                <xsl:param name="string"/>
                <xsl:variable name="apos" select="'"/>
                <xsl:if test="not(contains($string,$apos))"><xsl:value-of
select="$string"/></xsl:if>
                <xsl:if test="contains($string,$apos)">
                        <xsl:value-of
select="substring-before($string,$apos)"/><xsl:value-of
select="$apos"/><xsl:value-of select="$apos"/><xsl:call-template
name="escapeQuotes"><xsl:with-param
name="substring-after($string,$apos)"/></xsl:call-template>
                </xsl:if>
        </xsl:template>


I'm doing something wrong ... 

Philippe




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>