[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: translate quot to apos

Subject: Re: translate quot to apos
From: "Andrea Penna" <andreapenna@xxxxxxxxx>
Date: Wed, 23 Aug 2000 13:33:51 +0200
xsl translate apos
Similar problem here:

I have to change all "quote" and "apos" before use the string as a
javascript-function argument.
So I need to change every  "apos" to "\apos" or to "apos apos" and the same
with "quote" too.

But if I'm not wrong the translate function can substitute one character
with only another one and not with two or more:
"If the third argument string is longer than the second argument string,
then excess characters are ignored"
(from http://zvon.org/xxl/XSLTreference/Output/index.html site).

Also if I use variables. How to solve this?

This is the piece of my xsl file (not working because replacing &#39; with
&#39; and not with &#39;&#39;):

        <xsl:variable name="apos">&#39;</xsl:variable>
        <xsl:variable name="apos2">&#39;&#39;</xsl:variable>
        <xsl:variable name="quote">&#34;</xsl:variable>
        <xsl:variable name="quote2">&#34;&#34;</xsl:variable>
        <xsl:variable name="Abstract1" select="normalize-space(.)"/>
        <xsl:variable name="Abstract2"
select="translate($Abstract1,$apos,$apos2)"/>
        <xsl:variable name="Abstract3"
select="translate($Abstract2,$quote,$quote2)"/>
        <xsl:attribute name="onclick">NewWindow('<xsl:value-of
select="$Abstract3"/>')</xsl:attribute>

Thank you,
Andrea

> Best way is to use variables:
>
> <xsl:variable name="quot">"</xsl:variable>
> <xsl:variable name="apos">'</xsl:variable>
> <xsl:value-of select="translate(Tag1, $quot, $apos)"/>
>
> Mike Kay




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.