cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Schwarz" <saschw...@hotmail.com>
Subject Including XML into HTML as CDATA
Date Fri, 16 Apr 2004 01:11:46 GMT
Hi
I'm trying to generate html that displays the content of XML files to the 
user. I found this archive mail:
http://archives.real-time.com/pipermail/cocoon-users/2002-August/020937.html

And I looked at the the snippet sitemap for how Cocoon documentation 
displays xml in its html (it just embeds the <![CDATA[ ... ]]> directly in 
the xml file (which I can't do).

But I'm still stumped...

My sitemap declaration:
        <map:serializer logger="sitemap.serializer.html"
        	mime-type="text/html" name="ACML" pool-grow="4" pool-max="32" 
pool-min="4"
        	src="org.apache.cocoon.serialization.HTMLSerializer">
			<encoding>ISO-8859-1</encoding>
			<cdata-section-elements>div</cdata-section-elements>
	    </map:serializer>

My sitemap pattern
      <map:match pattern="(courses|view)/(.*).acml$" type="regexp">
        <map:generate src="web/{1}/{2}/{2}.acml" />
        <map:serialize type="ACML" />
      </map:match>

Src file:
<?xml version="1.0" encoding="UTF-8"?>
<div>
	<course id="20040408204930391" version="1.0" units="in" width="1200" 
length="240">
	<copyright>2004 Anonymous Person</copyright>
	</course>
</div>

In my browser I get:

<div><![CDATA[
	]]><course id="20040408204930391" version="1.0" units="in" width="1200" 
length="240">

<copyright>2004 Anonymous Person</copyright>

</course><![CDATA[
]]></div>

Seems to me the CDATA isn't wrapping the div element correctly...??

Is there some other way to do this?

I tried using a stylesheet to wrap the element but then I get the raw chars 
and not the CDATA behavior.

i.e.
<xsl:template match="/">
	<div>
	<xsl:text>&lt;![CDATA[</xsl:text>
		<xsl:copy>
			<xsl:apply-templates/>
		</xsl:copy>
	<xsl:text>]]&gt;</xsl:text>
	</div>
</xsl:template>

Any pointers are greatly appreciated.
Thanks
Steve

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar  get it now! 
http://toolbar.msn.com/go/onm00200415ave/direct/01/


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


Mime
View raw message