Javascript variables and xsl elements containing special characters

Subject: Javascript variables and xsl elements containing special characters
From: mvictor@xxxxxxxxxx
Date: Fri, 1 Dec 2000 17:16:44 -0500
Hello,
     I need to pass the value of a XSL element into a JavaScript variable.
I've searched for information, and this is what I've come up with.

given:

<desc>some text</desc>

I can do the following:

JSDesc = '<xsl:value-of select="desc"/>'
printDescription(JSDesc)

which results in:
JSDesc='some text'

This works fine for me, unless the element contains an apostrophe.  i.e.:
<desc>Mike's record</desc>


Using the same assignment method results in the following:

JSDesc='Mike's record'

which is invalid.

 I've tried various implementations of CDATA, but have not had any luck in
getting it to work.  In this case, CDATA seems to work fine for the other
special characters, but not the apostrophe.   How do I assign the value of
an XML element , which contains an apostrophe, to a JavaScript Variable?

Thanks



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


Current Thread