XSLT 2.0 implementation in Python?

View: New views
2 Messages — Rating Filter:   Alert me  

XSLT 2.0 implementation in Python?

by Christof Hoeke :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 > 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).

I have looked for a native Python implementation for some time now but
no chance it seems. With Jython 2.5final out Saxon is an alternative (I
currently try to use e.g. web.py with it to be able to use XSLT 2 for
web site templating). You could also try Saxon with IronPython, should
work but I have not tried it yet.

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. Does work but
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.

But if you find anything let me know!

Chris
_______________________________________________
XML-SIG maillist  -  XML-SIG@...
http://mail.python.org/mailman/listinfo/xml-sig

Re: XSLT 2.0 implementation in Python?

by Stefan Behnel-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

_______________________________________________
XML-SIG maillist  -  XML-SIG@...
http://mail.python.org/mailman/listinfo/xml-sig