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

Re: Troubles with libxslt in PHP again: CDATA in <scri

Subject: Re: Troubles with libxslt in PHP again: CDATA in <script>
From: "Martynas Jusevicius" <martynas.jusevicius@xxxxxxxxx>
Date: Thu, 11 Oct 2007 15:41:08 +0200
Re:  Troubles with libxslt in PHP again: CDATA in <scri
Well, not really, if I understood you right.
I'm using the standard function in PHP, XSLTProcessor::transformToXML():
http://dk2.php.net/manual/en/function.xsl-xsltprocessor-transform-to-xml.php

I have to load my source and stylesheet into DOMDocument, since it
takes them as parameters, but as the output I get a plain string.

Martynas

On 10/11/07, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> I seem to recall responding to your previous post pointing out that you were
> writing a DOM as your output and that you were therefore not invoking the
> XSLT serializer. That would seem to account for all your troubles.
>
> Michael Kay
> http://www.saxonica.com/
>
> > -----Original Message-----
> > From: Martynas Jusevicius [mailto:martynas.jusevicius@xxxxxxxxx]
> > Sent: 11 October 2007 13:01
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject:  Troubles with libxslt in PHP again: CDATA in <script>
> >
> > 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

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.