Subject: Re: [xsl] Content of Script element getting wrapped by CDATA From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 23 Oct 2008 16:27:03 +0100 |
> 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Content of Script element, Darcy Parker | Thread | Re: [xsl] Content of Script element, Darcy Parker |
Re: [xsl] Identifier attribute (was, G. Ken Holman | Date | Re: [xsl] Content of Script element, Darcy Parker |
Month |