[XML-SIG] XSLT 2.0 implementation in Python?

Stefan Behnel stefan_ml at behnel.de
Thu Jun 18 14:54:02 CEST 2009


Christof Hoeke wrote:
>> I just wanted to ask if there's any Python XML implementation which
>> supports XSLT 2.0 (e.g. <xsl:analyte-text>). The only thing I found was
>> Saxon, but it's only for Java/.NET (and I don't want to use Jython).
>
> Only option to use Java/Saxon via Python would to be call Saxon a an os
> command and pipe the result back to your Python program.

Sounds awfully slow, given the startup time of the average JVM, plus the
time it takes hotspot to heat up.

There's also JPype, GCJ or JCC if running Java is an option, see e.g.

http://ubuntuforums.org/archive/index.php/t-593327.html

http://pypi.python.org/pypi/JCC/
http://jpype.sourceforge.net/


> you still need Java in addition to Python but at least write your
> program in (C)Python. Also you cannot transform any e.g. lxml tree
> directly, you would have to reserialize any XML.

Should I say it? Serialisation and parsing are *fast* in lxml - don't know
about Saxon in Java, though. But given that both XSLT input and output can
be streamed, the I/O performance might not be that much of a problem
either (assuming large documents). Benchmarks will tell.

You could also write an HTTP based transformation service in Jython that
calls Saxon, and just run it in a permanently running JVM.

Stefan



More information about the XML-SIG mailing list