You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ole Hildebrandt <ol...@web.de> on 2004/06/11 12:42:56 UTC

CDATA and XSLT

Hi,

I have any XML-Inputstream containing CDATA-Sections (With 
HTML-Markup).  When I  directly serialize the generators output to  HTML 
the  HTML-Markup  is applied.  But as soon as I process the Data with an 
XSL-STylesheet, the Markup is Excaped (&lt,b&gt; etc) and not applied 
anymore. I tried to declare the CDATA-ELements in xsl:output 
cdata-section-elements, but this doesn't seem to have any effect.  Did 
anyone come across this problem and found a solution?

Here is the  Stylesheet I use for testing

    <xsl:output method="xml" cdata-section-elements="TEASERBODY"/>   
     <xsl:template match="node()|@*">
      <xsl:copy>
         <xsl:apply-templates select="node()|@*"/>
      </xsl:copy>
   </xsl:template>

Thanks

Ole


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CDATA and XSLT

Posted by Joerg Heinicke <jo...@gmx.de>.
On 11.06.2004 12:42, Ole Hildebrandt wrote:

> Hi,
> 
> I have any XML-Inputstream containing CDATA-Sections (With 
> HTML-Markup).  When I  directly serialize the generators output to  HTML 
> the  HTML-Markup  is applied.  But as soon as I process the Data with an 
> XSL-STylesheet, the Markup is Excaped (&lt,b&gt; etc) and not applied 
> anymore. I tried to declare the CDATA-ELements in xsl:output 
> cdata-section-elements, but this doesn't seem to have any effect.  Did 
> anyone come across this problem and found a solution?
> 
> Here is the  Stylesheet I use for testing
> 
>    <xsl:output method="xml" cdata-section-elements="TEASERBODY"/>       
> <xsl:template match="node()|@*">
>      <xsl:copy>
>         <xsl:apply-templates select="node()|@*"/>
>      </xsl:copy>
>   </xsl:template>

1. This is more or less an XSLT question and so this is not the 
appropriate list.

2. The Cocoon part of the question is the ignoring of xsl:output, you 
have to add the @cdata-section-elements to the serializer component 
declaration in the sitemap.

3. The behaviour you see is standard behaviour for XML "lifecycle" 
parse/transform/serialize. There is no difference between non-escaped 
markup in CDATA and escaped one outside of CDATA. So besides easier 
human reading there is no need for having CDATA sections.

Joerg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org