xsl-list
[Top] [All Lists]

[xsl] ESCAPE SINGLE QUOTES FOR JAVASCRIPT PARAMETER IN XSLT

2008-06-05 04:45:30
Hi,

I have the following extract of my xml:

xml
---

<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.

RecordLabel(this,'<xsl:value-of select="@AID" />',<xsl:value-of 
select="/Label/@ID" />,'A','<xsl:value-of select="@AR" />');

XSLT
----

<td width='18px'>
  <input type="CheckBox" id='{(_at_)AID}_A' align='middle' class='ai'>
    <xsl:attribute name="onclick">
      RecordLabel(this,'<xsl:value-of select="@AID" />',<xsl:value-of 
select="/Label/@ID" />,'A','<xsl:value-of select="@AR" />');
    </xsl:attribute>
  </input>
</td>


OUTPUT
------

<td width="18px">
 <input type="CheckBox" id="768564_A" align="middle" class="ai"  onclick="&#xA; 
             RecordLabel(this,'766807',gb03spp,'A','I Don't Listen To 
It');&#xA;            ">
</td>

Cheers

C


      __________________________________________________________
Sent from Yahoo! Mail.
A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html

--~------------------------------------------------------------------
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>