[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: "Darcy Parker" <darcyparker@xxxxxxxxx>
Date: Thu, 23 Oct 2008 08:43:50 -0400
Re:  Content of Script element getting wrapped by CDATA
Hi Joyce,

Glad you're making progress.  (I used an XSLT 2.0 style identity
transform.  I think you figured it out... if you replace it with your
preferred XSLT 1.0 identity transform, then that should work.)

With regards to the CDATA tag being added by libxslt automatically - I
would agree with David.  It sounds like a bug for this element's
text() node to be output this way.  It should only do this if you have
@cdata-section-elements set to script in xsl:output.  And if the only
output is <xsl:text> or <xsl:value-of> and they have
disable-output-escaping="yes", then there should be no CDATA.  I would
investigate with the libxslt community.

Darcy
On Thu, Oct 23, 2008 at 5:22 AM, Joyce Babu <joyce@xxxxxxxxxxxxx> wrote:
> Oops! It works only with Sablatron. Libxslt wraps the processed value
> again in another CDATA tag and Xalan and Saxon shows the message
> "Error on line 0"
>
> On Thu, Oct 23, 2008 at 2:48 PM, Joyce Babu <joyce@xxxxxxxxxxxxx> wrote:
>> It did work. Here is the final working code
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>>
>> <xsl:output method="xml" omit-xml-declaration="yes" indent="no"
>> encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
>> doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
>>
>> <xsl:template match="/">
>>   <html xml:lang="en" lang="en">
>>      <!-- Include Header-->
>>      <xsl:apply-templates select="/head" />
>>      <body>
>>      </body>
>>   </html>
>> </xsl:template>
>>
>> <xsl:template match="script">
>>   <xsl:copy>
>>      <xsl:apply-templates select="@*"/>
>>                 <xsl:value-of disable-output-escaping="yes"
>>
>> select="concat('//&lt;![CDATA[&#xA;',text(),'&#xA;//]]&gt;')"/>
>>   </xsl:copy>
>> </xsl:template>
>> <xsl:template match="style">
>>   <xsl:copy>
>>      <xsl:apply-templates select="@*"/>
>>      <xsl:value-of disable-output-escaping="yes"
>>
>> select="concat('&lt;![CDATA[&#xA;',text(),'&#xA;]]&gt;')"/>
>>   </xsl:copy>
>> </xsl:template>
>>
>> <!--Identity Transform-->
>> <xsl:template match="*">
>>   <xsl:copy>
>>      <xsl:apply-templates select="@* | node()"/>
>>      <!--xsl:apply-templates select="node()"/-->
>>   </xsl:copy>
>> </xsl:template>
>> <xsl:template match="@*|text()|comment()|processing-instruction()">
>>   <xsl:copy/>
>> </xsl:template>
>>
>> </xsl:stylesheet>
>>
>> I wrote a separate template for style, since I don't think the single
>> line comment (//) is not supported by css.
>>
>> Thanks a lot for helping me with this.
>>
>> Joyce

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.