[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XML element to Javascript var via XSL

Subject: XML element to Javascript var via XSL
From: "Nik Coughlin" <nrkn@xxxxxxxxxxx>
Date: Wed, 5 Nov 2003 14:33:08 +1300
javascript var
I want to be able to load the contents of an XML element into a
Javascript variable via XSL.  It works fine if the <content> element
in the XML file looks like this:

<content><![CDATA[<table><tr><td>Table
Content</td></tr></table>]]></content>

and the XSL is as follows:

<xsl:variable name="content" select="content" />

With the Javascript being:

NewTable.innerHTML='{$content}';

BUT 

For readability and ease of use etc. I want to be able to use the
<content> element as follows:

<content>
  <![CDATA[
    <table>
      <tr>
        <td>Table Content</td>
      </tr>
    </table>
  ]]>
</content>

If I do this, the Javascript returns an Unterminated String Constant
error, which is fair enough, as I suppose I am essentially trying to
do this:

NewTable.innerHTML='    <table>
      <tr>
        <td>Table Content</td>
      </tr>
    </table>';

I tried using <xsl:strip-space elements="content" />, but to no avail
(I guess I don't understand how it works).  This is driving  me
crazy, does anyone know a way to do this?
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
                nrkn
http://www.livejournal.com/users/nrkn
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.