OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   RE: [xml-dev] Insert HTML Page into XML CDATA Tag

[ Lists Home | Date Index | Thread Index ]

> I have a very big problem.
> I create a little web site and I use XSL + XML to produce
> output.Now I
> want to add a part of html page into xml tag to use a custom
> page section.
> But i find a problme,
> see the example :
> I use this xml :
> <resources>
>     <html><![CDATA[<B>Hello World</B>]]></html>
> </resources>

The purpose of CDATA is to tell the XML parser that the <B> is to be treated
as ordinary character data, not as markup. In your case you want it treated
as markup. So why are you putting it in CDATA?

Perhaps it's HTML rather than XML, so you can't nest it directly. The best
answer to that is to make the HTML into XHTML. But OK, you can't always do
that when you have lots of legacy HTML. To deal with that messy situation,
XSLT provides a messy tool: it's called disable-output-escaping="yes". Use
it only when you are desparate, and can't find a proper design solution to
the requirement.

Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com



News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS