Re: [xsl] Re: Un-cdata-section-elements

Subject: Re: [xsl] Re: Un-cdata-section-elements
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 22 Mar 2006 10:05:27 GMT
> Again, the problem isn't the validity of the markup, but the
> JavaScript as interpreted by various browsers; some processors
> (possibly all?) will throw a CDATA around anything in the <script>
> element by default, mostly because the chance of bumping into
> non-valid stuff is high.

No. HTML processors interpret the content of a script as CDATA as HTML's
script element is defined to be of type CDATA. CDTATA elements do not
exist in XML so in XHTML script is a normal element (with PCDATA
content). Your problem is just caused by sending a page marked up in one
language (XHTML) to a browser written to interpret another (HTML).
It's like sending Java to a C compiler: you get syntax errors.

> The '// CDATA' best-practice rule is of course inclusive of all
> browsers, new and old, and I would have liked to play it that way. Oh
> well.

You can use disable-output-escaping to get that from XSLT, if you must.

<xsl:text disable-output-escaping="yes"><![CDATA[
//<![CDATA[
  ..... stuff here ...
//]]>]]&gt;
</xsl:text>


David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread