[xsl] ESCAPE SINGLE QUOTES FOR JAVASCRIPT PARAMETER IN XSLT

Subject: [xsl] ESCAPE SINGLE QUOTES FOR JAVASCRIPT PARAMETER IN XSLT
From: Cleyton Jordan <cleytonjordan@xxxxxxxxxxx>
Date: Thu, 5 Jun 2008 11:45:01 +0000 (GMT)
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='{@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

Current Thread