This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: JavaScript error in CDATA section: IE specific


This arises from a subtle inconsistency between XML and HTML parsing rules.
http://msdn.microsoft.com/isapi/msdnlib2.idc?theURL=/library/psdk/xmlsdk/xsl
p0rho.htm recommends this:

<SCRIPT><xsl:comment><![CDATA[
  script including < here
]]></xsl:comment></SCRIPT>

The result is both well-formed XML, and can be read by browsers as HTML.

- Jonathan Marsh
  Microsoft

-----Original Message-----
From: Charlie Kaiman [mailto:ckaiman@i3solutions.com]
Sent: Friday, April 07, 2000 9:10 AM
To: XSL-List (E-mail)
Subject: JavaScript error in CDATA section: IE specific


I'm wondering if someone has experienced a problem with IE, where a
character in a CDATA section is returned as an entity reference????  Here's
my JavaScript code (wrapped in a CDATA section, in an XSL Style Sheet):
 
<SCRIPT LANGUAGE="JavaScript">
<![CDATA[

function xmlParse() {
 source = document.XMLDocument;
 xNode = source.getElementsByTagName("data_x").item(0);
 strXNode = xNode.text;
 for (i = 0; i < strXNode.length; i++) {
  alert(strXNode);
 }
}
]]></SCRIPT>
 
I am getting an error due to the script being parsed out as:
 
<SCRIPT LANGUAGE="JavaScript">
<![CDATA[

function xmlParse() {
 source = document.XMLDocument;
 xNode = source.getElementsByTagName("data_x").item(0);
 strXNode = xNode.text;
 for (i = 0; i &lt; strXNode.length; i++) {
  alert(strXNode);
 }
}
]]></SCRIPT>
 
Note the "&lt;" in the script????  Is this a bug, or am I doing something
wrong?  Has anyone experienced the same problem?  Thanks!!


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]