|
Subject: Re: [xsl] Troubles with libxslt in PHP again: CDATA in <script> From: Abel Braaksma <abel.online@xxxxxxxxx> Date: Fri, 12 Oct 2007 00:24:25 +0200 |
<?xml version="1.0"?>
<html>
<head>
<title>test</title>
<script>
function myfunc()
{
if(x>y) return 1;
if(x<y) return 0;
}
</script>
</head>
<body>
<h1>Hello world</h1>
</body>
</html>HTH, Cheers, Abel Braaksma
Hi xsl-list,
I'm working with PHP 5.2, and its XSL extension based on libxslt is giving me headache again. It used to add Content-Type <meta> in my XHTML output where it was not supposed to, and now in a similar manner it is implicitly adding CDATA sections inside my <script> elements.
Most of the browsers do not understand CDATA in <script>, so that gives JavaScript syntax error. Putting // comments to prevent that is also not possible, since libxslt always puts CDATA before them. Putting //<xsl:comment> to wrap my own CDATA used to do the trick, but it does not work anymore with PHP 5.2.5 - libxslt wraps the leading // in CDATA as well.
I think it is the same issue as in "Preventing CDATA output in XHTML": http://www.biglist.com/lists/xsl-list/archives/200707/msg00060.html
I read that thread, but couldn't find any real solution that would fit me. Upgrading libxslt is not an option, since it is built-in into PHP. Can you think of any solutions or workarounds?
I'm using "xml" output method and XHTML 1.0 Strict doctype. I also have to stick to "text/html" content type since Google Maps API (for which I'm producing JavaScript) does not work properly with "application/xhtml+xml".
Martynas Jusevicius www.xml.lt
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Troubles with libxslt in , David Carlisle | Thread | Re: [xsl] Troubles with libxslt in , Martynas Jusevicius |
| RE: [xsl] Windows Batchfile calling, Kerry, Richard | Date | RE: [xsl] More addition questions: , Deborah Pickett |
| Month |