Re: [xsl] RE: Javascript quote escaping xx = (' ... \' ... ')

Subject: Re: [xsl] RE: Javascript quote escaping xx = (' ... \' ... ')
From: Maciek Adwent <maciekadwent@xxxxxxxxx>
Date: Wed, 31 Aug 2005 10:36:45 -0400
I've been trying to figure out a way to do this too by just using the
translate() function, but it doesn't work out for me. What I would
like to do is be able to simply go

var x = '<xsl:value-of select="translate($mystring, '\'', '\\\'')" />';

Or something similar -- the idea being that you would do it in just
one line. My current solution is a template that is ugly to call. Any
ideas anyone? I think the only way is to write a long template, which
kinda sucks if you want to avoid using one for such a simple
transformation.


On 6/1/05, Bovy, Stephen J <STEPHEN.Bovy@xxxxxx> wrote:
> I need to imbed some xsl ouput within a
> JavaScript string literal assignment statement, for example:
>
> txt += '<xsl:value-of select="." />'
>
> Is there a way to configure my xsl style sheet to automatically
>
> convert single quote occurances to javascript escape format :
>
> (')  to --> (\') ???????
>
>



--
Maciej Adwent (maciekadwent@xxxxxxxxx)

Current Thread