-
XSL and CDATA section
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.
-
Re: XSL and CDATA section
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.
-
Re: XSL and CDATA section
"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 utput 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.
>
-
Re: XSL and CDATA section
> I solved it by using <xsl utput 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.
-
Why don't you try the property cdata-section-elements ="your element name" inside <xsl utput ? it worked for me
 Originally Posted by Jason
> I solved it by using <xsl utput 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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks