Does Python 2.5 include a package to natively transform an XML document?
-
06-07-2019 - |
Question
In my Python app, I have an XML document that I'd like to transform using my XSL file. I'm currently using xml.etree to generate the XML document, but I haven't found anything within Python 2.5 that will allow me to natively transform my XML document.
I've already found one library (libxslt) which can execute the transformation, but I figured Python would have a native library that achieves the desired result.
Any thoughts?
Solution
There is no XSLT processor in Python 2.5.
OTHER TIPS
If you have libxml2 and libxslt installed, then also install lxml. It provides a nice, easy-to-use binding for libxml2 and libxslt, and it also implements the ElementTree API.
libxml2/libxslt also come with their own, much lower-level Python bindings, but lxml is much more straightforward and pythonic, and it seems to have great performance as well.