views:

596

answers:

2

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?

+4  A: 

There is no XSLT processor in Python 2.5.

Martin v. Löwis
I think you meant something like "there is no XSLT processor in the Python 2.5 standard library", or even "AFAIK there is no pure python XSLT processor". :)
ΤΖΩΤΖΙΟΥ
I meant the former. The latter is not the case - there is indeed a pure python XSLT processor (4XSLT).
Martin v. Löwis
+4  A: 

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.

ChuckB