Click to See Complete Forum and Search --> : XSL and CDATA section
Mahesh
04-01-2002, 12:45 AM
Hi everyone,
I have a xml doc with cdata section which contains html tags. I am using
an xsl stylesheet to generate html output. I want that the html tags contained
in my xml cdata section should not be escaped i.e. "<ul>" should remain as
"<ul>", but I find that xsl transformation escapes these characters and what
I get is "<ul>". I even tried disable-output-escape, but it still comes
out the same. I tried with output mode both as html and xml.
Any help on this will be highly appreciated.
Mahesh -
If <text> is the element containing your CDATA, try the
following in your XSLT:
<xsl:template match="text">
<xsl:cdata>
<xsl:value-of select="."/>
</xsl:cdata>
</xsl:template>
Best of Luck,
Rick
"Mahesh" <mahesh_menghani@yahoo.com> wrote:
>
>Hi everyone,
>I have a xml doc with cdata section which contains html tags. I am using
>an xsl stylesheet to generate html output. I want that the html tags contained
>in my xml cdata section should not be escaped i.e. "<ul>" should remain
as
>"<ul>", but I find that xsl transformation escapes these characters and
what
>I get is "<ul>". I even tried disable-output-escape, but it still comes
>out the same. I tried with output mode both as html and xml.
>Any help on this will be highly appreciated.
Mahesh
04-01-2002, 09:38 AM
"Rick" <rsteinberger@icmarc.org> wrote:
>Hey Rick,
Thanks for your response, but it didn't work guess since I am using .net
xml.
The problem appears only when
I am using XSLTransform.transform method of .Net XML, but not with domdocument.transform
method of MSXML4.
I solved it by using <xsl:output method="text"> instead of html.
Thanks a lot,
Mahesh
>Mahesh -
>
>If <text> is the element containing your CDATA, try the
>following in your XSLT:
>
><xsl:template match="text">
> <xsl:cdata>
> <xsl:value-of select="."/>
> </xsl:cdata>
></xsl:template>
>
>Best of Luck,
>
>Rick
>
>
>
>"Mahesh" <mahesh_menghani@yahoo.com> wrote:
>>
>>Hi everyone,
>>I have a xml doc with cdata section which contains html tags. I am using
>>an xsl stylesheet to generate html output. I want that the html tags contained
>>in my xml cdata section should not be escaped i.e. "<ul>" should remain
>as
>>"<ul>", but I find that xsl transformation escapes these characters and
>what
>>I get is "<ul>". I even tried disable-output-escape, but it still comes
>>out the same. I tried with output mode both as html and xml.
>>Any help on this will be highly appreciated.
>
Jason
04-05-2002, 01:12 PM
> I solved it by using <xsl:output method="text"> instead of html.
What if you don't specify the "method" attribute? That should output well
formed XML. If you specify "HTML," that is trying to put out well formed
HTML, which is NOT well formed XML.
LigonGL
07-23-2008, 01:10 AM
Why don't you try the property cdata-section-elements ="your element name" inside <xsl:output ? it worked for me :)
> I solved it by using <xsl:output method="text"> instead of html.
What if you don't specify the "method" attribute? That should output well
formed XML. If you specify "HTML," that is trying to put out well formed
HTML, which is NOT well formed XML.
devx.com
Copyright Internet.com Inc. All Rights Reserved