which Python XSLT module?

Mike Brown mike at skew.org
Wed Feb 5 18:07:36 EST 2003


"Will Stuyvesant" <hwlgw at hotmail.com> wrote:
> We have to translate a couple of XML documents to various other
> formats.  XSLT seems good for this.  Is there Python support for XSLT
> that works out-of-the-box?
>
> After installing pyxml and doing "import xml.xslt" as some examples
> suggest I get an error already...

My understanding is that xml.xslt in PyXML is currently frozen at the same
code that was released in 4Suite 0.10.2 (which required PyXML anyway) plus
some patches.

Since then, 4Suite has shed its PyXML dependency (as long as one has expat +
pyexpat, and no need for a validating parser), although if you do have
PyXML, it must be a certain version to be 100% compatible with 4Suite.
4Suite has also moved to its own package structure (Ft.Xml.Xslt rather than
xml.xslt, for example) and a number of its APIs have changed (e.g., it now
uses SAX-like InputSource objects).

XSLT support in PyXML has not really been deprecated; things are just in
flux. This is in part because 4Suite is now Python 2.1+ only, and is using C
extensions for speed, while PyXML is trying to remain pure Python; and also
just because 4Suite is still considered unstable. When 4Suite 0.12.0 is
finally released (there are currently 3 alphas out, and a beta coming soon),
there are plans to update PyXML's xml.xslt to match, although some recent
developments in 4Suite may complicate and lengthen this process. For now, I
suggest using PyXML 0.8.2 with 4Suite 0.12.0b1 from CVS. See
http://4suite.org/

There are a couple of buggy XPath edge cases that will be fixed in the
coming weeks, but on the whole, XSLT processing with the latest 4Suite code
from CVS is almost comparable to Saxon in terms of speed and conformance. It
also installs entirely in {python-lib}/site-packages/Ft, so you can easily
remove it if you run into problems.

4Suite's documentation is still sketchy, but Uche Ogbuji's articles on
xml.com and his rough notes for future documentation at
http://uche.ogbuji.net/tech/akara/pyxml/ will get you started with the APIs.
There's also a command-line 4xslt tool.

> Somebody suggested "4Suite" but
> others reported many errors and installation problems with that.

Where are these reports?

Most packaged versions of 4Suite (RPMs for example) are not up to date, so I
wouldn't rely on them to work. Get the code directly from 4suite.org.






More information about the Python-list mailing list