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

Re: Content of Script element getting wrapped by CDATA

Subject: Re: Content of Script element getting wrapped by CDATA
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 23 Oct 2008 16:27:03 +0100
Re:  Content of Script element getting wrapped by CDATA
> If output is set to html and remove the script template, then XSLT
> (saxon at least) does not escape the output.

there is no way t escape anything inside an html script element as
neither < nor & is recognised as special markup. the only markup that is
recognised as markup is </script> script in html acts like a CDATA
section acts in XML.

> But if the output is set to XML, then it does seem necessary to use a
> javascript comment on the CDATA because even though the output is set
> to strict XHTML, the browser I tried (firefox) doesn't seem to
> understand CDATA in the script element.

If you serve the file with an xml mime type then the CDATA section isn't
needed and if it is there it will be parsed correctly, if you generate
XHTML but serve it as html then you are generating XML but parsing it
with an html parser which leads to parse errors, but the solution is
just don't do that, surely.

>  Hence the complicated workaround of putting a javascript comment in
> front of the CDATA.  I  wished browsers would just understand CDATA
> when the doctype is xhtml 

they undertand XML syntax if you tell them it is an XML file, which means
using an XML mime type (not just using an XML doctype, which doesn't
affect whether an xml parser is used, just whether the html renderer
uses standard or quirks mode

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

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.