Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pure Python XSLT library

Tags:

Is there an XSLT library that is pure Python?

Installing libxml2+libxslt or any similar C libraries is a problem on some of the platforms I need to support.

I really only need basic XSLT support, and speed is not a major issue.

like image 763
Andy Balaam Avatar asked Sep 26 '08 09:09

Andy Balaam


2 Answers

Unfortunately there are no pure-python XSLT processors at the moment. If you need something that is more platform independent, you may want to use a Java-based XSLT processor like Saxon. 4Suite is working on a pure-python XPath parser, but it doesn't look like a pure XSLT processor will be out for some time. Perhaps it would be best to use some of Python's functional capabilities to try and approximate the existing stylesheet or look into the feasibility of using Java instead.

like image 123
Jon W Avatar answered Sep 22 '22 09:09

Jon W


I don't think you can do it in cpython: there are no pure python XSLT implementations.

But you can trivially do it in jython, using the inbuilt XSLT APIs of the JVM. I wrote a blog post for the specific case of doing it on Google AppEngine, but the code given should work under jython in anyn circumstances.

Transforming with XSLT on Google AppEngine and jython

http://jython.xhaus.com/transforming-with-xslt-on-google-appengine-and-jython/

HTH,

Alan.

like image 32
Alan Kennedy Avatar answered Sep 18 '22 09:09

Alan Kennedy