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

RE: Output in XML / HTML, double tags and CDATA in sc

Subject: RE: Output in XML / HTML, double tags and CDATA in script.
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 17 Feb 2009 18:03:32 -0000
RE:  Output in XML / HTML
If you want to use the HTML output method, don't put your result elements in
the XHTML namespace.

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: sOLOWXEW aNDREJ [mailto:solovev@xxxxxxxxxxxxxx]
> Sent: 17 February 2009 17:21
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Output in XML / HTML, double tags and CDATA in script.
>
> Hi. I have such XSLT code:
>
> <?xml version="1.0"?>
> <xsl:stylesheet
>  version="1.0"
>  xmlns="http://www.w3.org/1999/xhtml"
>  xmlns:php="http://php.net/xsl"
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
>
>  <xsl:output method="html" encoding="utf-8"
>
> doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transit
> ional.dtd"
>   doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
> indent="yes" />
>
>  <xsl:template match="/">
>   <html>
>    <body>
>     <script language="Javascript">
>       if(1 == 1 &amp; 2 == 2)
>        alert(1);
>     </script>
>     <br/>
>     <img src="test.jpg"/>
>    </body>
>   </html>
>  </xsl:template>
> </xsl:stylesheet>
>
> When i'm using output method="html", i have  <br/> and <img/>
> tags transformed to  <br></br>  and  <img></img>. This makes
> big problems, such as IE and Opera makes two newlines on
> <br></br> and FF only one.
> So i put output method="xml" and <br/> tag remains the same.
> But CDATA appears in <script>. It looks like <script
> language="Javascript"><![CDATA[
>                   if(1 == 1 & 2 == 2)
>                      alert(1);
>             ]]></script>
> in result html. And this is javascript error.
> Is there any way to solve this problem?  I need "<br/>" style
> tags in my result html and working script.
>
> I'm using Apache and PHP  XSLT transform. phpinfo: libxslt
> Version 1.1.17 libxslt compiled against libxml Version 2.6.26
> EXSLT enabled libexslt Version 0.8.13

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.