Am Montag, 26. September 2005 15:57 schrieb Martin Koekenberg:
> Hello,
>
> I've a xml file on the file system (the source is on an other webserver and
> the download is scheduled). How ca I parse this file with a xslt in Zope.
> ZopeXMLmethods isn't working annymore in Zope 2.8.1.
>
> Does annyone knows a Product of method to parse xml in Zope without the
> zopeXMLmethods product ?
>
> Regards,
>
> Martin Koekenberg
I do it like this (ExternalMethod in this case):
--------------------------------------------------------------------
import libxml2
import libxslt
stylestring = file("/path/to/style/file.xsl").read()
def xslt(data):
# note: if styledoc and style are defined outside the function,
# zope dumps core :-(
styledoc = libxml2.parseDoc(stylestring)
style = libxslt.parseStylesheetDoc(styledoc)
doc = libxml2.parseDoc(data)
result = style.applyStylesheet(doc, None)
html = style.saveResultToString(result)
style.freeStylesheet()
doc.freeDoc()
result.freeDoc()
return html
--------------------------------------------------------------------
may be not very smart, but it's working :-)
Cheers,
Sascha
_______________________________________________
Zope maillist - [email protected]
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )