Subject: [xsl] XML element to Javascript var via XSL From: "Nik Coughlin" <nrkn@xxxxxxxxxxx> Date: Wed, 5 Nov 2003 14:33:08 +1300 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XMP in Binary Files, David . Pawson | Thread | Re: [xsl] XML element to Javascript, David Carlisle |
RE: [xsl] XMP in Binary Files, Haas, Carl | Date | [xsl] How To Call XSL Template With, Beverly L. Parmelee |
Month |