[Zope] Using ZPT to create XML - early processing

Ed Leafe ed@leafe.com
Sat, 15 Mar 2003 17:37:15 -0500


	I've had good success generating XML using Page Templates, but just 
ran into a problem I can't figure out. I'm trying to create an RSS 2.0 
feed, and wanted to be able to fill in the time dynamically in the 
comment at the top of the page. Here's an example of the first three 
lines of the page template:

<?xml version="1.0" ?>
<!-- RSS generated by Zope 2.6.1 on Sat, 15 Mar 2003 13:29:11 EST -->
<rss version="2.0" xmlns:tal="http://xml.zope.org/namespaces/tal" 
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance">

	If I try to use TAL in the comment line, it doesn't get processed. It 
seems that ZPT will not process TAL content within the comment. I've 
also tried to generate the whole comment tag from TAL using something 
like:

<dummy tal:replace="python:'<!-- foo -->'">foo</dummy>
  - or -
<dummy tal:replace="structure python:'<!-- foo -->'">foo</dummy>
  - or -
<dummy tal:replace="structure python:'<' + '!' + '-- foo 
-->'">foo</dummy>

but they all result in an error when I try to save it:
	Compilation failed
	xml.parsers.expat.ExpatError: not well-formed (invalid token): line 
17, column 35

	So is there any way to generate commented XML using TAL?

      ___/
     /
    __/
   /
  ____/
  Ed Leafe
  http://leafe.com/
  http://opentech.leafe.com