Subject: Re: [xsl] ESCAPE SINGLE QUOTES FOR JAVASCRIPT PARAMETER IN XSLT From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Thu, 05 Jun 2008 17:45:31 +0200 |
<A AR="I Don't Watch It" AID="768564" APID="76158" AC="5"/>
As you can see the value of the @AR attribute has a single quote. This is causing me a lot of problems when I use xslt to call a javascript function passing the parameters.
I was wondering if someone could help me to find a solution for that.
<xsl:function name="my:escape" as="xs:string"> <xsl:param name="s" as="xs:string"/> <xsl:sequence select="replace( replace( replace( replace($s, "'", "\\'"), '"', '\\"' ), '\r', '\\r' ), '\n', '\\n' )"/> </xsl:function>
You can the use it as e.g. '<xsl:value-of select="my:escape(@AR)"/>'
Martin Honnen http://JavaScript.FAQTs.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] ESCAPE SINGLE QUOTES FOR , Martin Honnen | Thread | Re: [xsl] ESCAPE SINGLE QUOTES FOR , Cleyton Jordan |
Re: [xsl] Multi part mime message i, Senthilkumaravelan K | Date | [xsl] XPath Against OpenXML and Ope, Ronnie Royston |
Month |