ZPT Was: Good XML tools?
Thomas Guettler
zopestoller at thomas-guettler.de
Wed Jul 31 07:01:07 EDT 2002
Alan Kennedy wrote:
> Laurent Szyster wrote:
>
>>In many case (if not most) XML processing is far easier with a
>>dedicated language like XSLT. Use Python to generate XML and/or
>>XSLT, but don't use it to transform XML: XSLT is far better at it.
>>
>
> I strongly disagree.
>
> Have you looked at Zope Page Templates at all? ZPT is a way of
> controlling the generation of (X|HT)ML from python.
>
> It is my own opinion that ZPT and Python is far superior to XSLT, for
> the following reasons.
>
[cut]
I programmed with ZPT, but I switched back to generating HTML
with pure python:
Example: (ignore the german words)
def editListsForm(self, REQUEST):
"docstring"
ret=[]
ret.append(self.standard_html_header())
ret.append('''
<form action="editListsAction">
<b>Projekte:</b>
Bitte wählen Sie die zu löschenden Projekte aus: <br><br>
%s
Hinzufügen eines neuen Projekts:
<input type="text" name="new_projekt">
<br>
<input type="submit" value="Ausführen">
</form>''' %(
Utils.keywordInput('del_projekt',
self.defaults.GRS.grs_projektList())))
ret.append(self.standard_html_footer())
return string.join(ret)
I switched to python from ZPT because python always gives me the
line number where the typo/bug is. I wasted too much time searching
an error message that happend in an eval().
If I have to create HTML or XML from an XML source I write a SAX parser
store the data in python classes or dictionaries and then serialize it to
XML or HTML.
I prefer this to the magic done by ZPT or DTML
thomas
More information about the Python-list
mailing list