You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "bober, paul" <bo...@emc.com> on 2000/08/07 12:49:21 UTC
loading external HTML as XML CDATA sections
I'm trying to load external HTML in to my XSP pages. The HTML is embedded as
CDATA elements of an XML document. Unfortunately the tokens in the CDATA
region get escaped when I don't want them to be. Thus, the browser
recognizes them as text instead of HTML.
I've implemented a custom tag to parse the XML at run time using the
XSP-supplied DOM parser and to load it in to my XSP page.
(xspCurrentNode.appendChild(....). etc)
How can I convert the CDATA regions to something that the browser will
interpret as HTML? I've tried using <xsl:text
disable-output-escaping="yes"> but this does not work
(I end up with a PI surrounding my escaped text--is this broken?).
Here is an example of the XML
<?xml version="1.0"?>
<templateItems template="/Templates/skeleton.dwt">
<item name="doctitle"><![CDATA[<title>Add Domain</title>
]]></item>
<item name="Title"><![CDATA[<SPAN class="inclSize3">iAdd
Domain </SPAN>]]></item>
<item name="main"><![CDATA[
<form method="POST" action="ProcessDomainForm.xsp"
name="xxx">
stuff deleted for brevity
]]
</form>
</item>
</templateItems>
Another problem I have is that I've noticed in the DOM tree that the nodes
corresponding to the CDATA regions show up as *siblings* of the item
elements instead of *children* of them. Perhaps I'm misinterpreting
something here, but when I iterate through the children of the
<templateItems> element and print out the result of getNodeName() I see
nodes named both "item" and "#text". I presume that the later are the CDATA
regions.
In case you're wondering, I'm trying to use Dreamweaver to generate some of
the pages in my application. I've generated a set of template pages in
Dreamweaver which correspond to some XSL skeletons that I've implemented.
Dreamweaver has a mechanism to export the editable regions of a page to XML.
I'm inserting this XML in my XSPs.
I'm doing this so I can use the graphical editing features of Dreamweaver to
design parts of pages (mainly forms), while also incoporating other
data/logic/styling to the pages that I can't do dynamically with
Dreamweaver.
Thanks in advance for any assistance.
Paul
Re: loading external HTML as XML CDATA sections
Posted by Jeremy Quinn <je...@media.demon.co.uk>.
At 06:49 -0400 07/08/00, bober, paul wrote:
>I'm trying to load external HTML in to my XSP pages. The HTML is embedded as
>CDATA elements of an XML document. Unfortunately the tokens in the CDATA
>region get escaped when I don't want them to be. Thus, the browser
>recognizes them as text instead of HTML.
May I suggest that you mark up your HTML as xHTML, ie. as XML compliant
HTML, then leaving out the CDATA tag, include it as XML.
The formatter will take care of converting your xHTML back into HTML
automatically.
Hope this helps
Jeremy
--
___________________________________________________________________
Jeremy Quinn Karma Divers
webSpace Design
HyperMedia Research Centre
<ma...@mac.com> <http://www.media.demon.co.uk>
<phone:+44.[0].20.7737.6831> <pa...@sms.genie.co.uk>