Have a look @ xml2html.xslt (one of the Cocoon system stylesheets). > -----Original Message----- > From: Steve Schwarz [mailto:[EMAIL PROTECTED] > Sent: Friday, 16 April 2004 1:12 p.m. > To: [EMAIL PROTECTED] > Subject: Including XML into HTML as CDATA > > > 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-Augu > st/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><![CDATA[</xsl:text> > <xsl:copy> > <xsl:apply-templates/> > </xsl:copy> > <xsl:text>]]></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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
