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

RE: Dealing with javascript and CDATA in XSL

Subject: RE: Dealing with javascript and CDATA in XSL
From: "Josh Canfield" <Josh.Canfield@xxxxxxxxxxxx>
Date: Thu, 19 Feb 2004 11:50:54 -0800
javascript cdata
You are ending the CDATA section with the first occurrence of ]]>. Try breaking apart the javscript string like this:

   dom.loadXML('<TEST><T att="1"/><T att="2">testing</T><T
att="3"><![CDATA[a<B>bc</B>d]' + ']></T></TEST>');

Now the XML parser used by your XSLT engine won't see the ]]>, but the javascript XML parser will.

Hope this helps,
Josh
-----Original Message-----
From: Karl J. Stubsjoen [mailto:karl@xxxxxxxxxxxxx]
Sent: Wednesday, February 18, 2004 9:13 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Dealing with javascript and CDATA in XSL


Hi there,

Having trouble with som JavaScript.  Trying to do the following:
----------------------------------------------------------------------------
---------
<script language="JavaScript" type="text/javascript">
        //<![CDATA[
        <!--
   dom.loadXML('<TEST><T att="1"/><T att="2">testing</T><T
att="3"><![CDATA[a<B>bc</B>d]]></T></TEST>');

writeToLayer('select_signature',dom.documentElement.selectSingleNode("T[@att
='3']").text);
        //-->
        //]]>
</script>
----------------------------------------------------------------------------
---------

I get the following error:
End tag 'T' does not match the start tag 'script'.


However, if I remove the CDATA section inside my <T att="3"> element, so I
have:
----------------------------------------------------------------------------
---------
<script language="JavaScript" type="text/javascript">
        //<![CDATA[
        <!--
   dom.loadXML('<TEST><T att="1"/><T att="2">testing</T><T
att="3">bc</T></TEST>');

writeToLayer('select_signature',dom.documentElement.selectSingleNode("T[@att
='3']").text);
        //-->
        //]]>
</script>

----------------------------------------------------------------------------
---------

So I guess I'm having trouble with that CDATA section on the inside there.
Uggg, what to do?  Ahhh, just thought of an idea.  Going to try and use
endoded < and > for those.  Nope, didn't seem to work.

Any help would be appreciated!

Karl



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


 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.