[mod_python] Speaking of Output Filters....

Lee Brown administrator at leebrown.org
Tue Apr 11 07:02:43 EDT 2006


Greetings!

I'm not sure if you can add XSLT extensions in lxml or not - the
documentation (so far) is mostly a number of examples.  (see
http://codespeak.net/lxml/api.html).

If being limited to Python 2.3 isn't a problem for you, there's a Python
binding for Apache's Xerxes/Xalan called Pyana
(http://pyana.sourceforge.net) which is simple, slick, and fast.  It's very
easy to add external Python functions as XSLT extensions with Pyana.  The
downside of Pyana is that it does not support Xinclude and it is compiled
against static DLLs for Xerxes, Xalan, and Python23 so it doesn't keep up
with the latest features.  I was using Pyana for my filters at first, but
the lack of support for Xinclude and Python 2.4 made me switch.

For what it's worth, Amara/4Suite has the the most comprehensive feature set
of any of the XML/XSLT processors I've tried but it's main drawback is that
it is crawlingly slow.  The same filters implemented in Amara/4Suite are
about ten times slower.


Best Regards,
Lee E. Brown
(administrator at leebrown.org)

-----Original Message-----
From: mod_python-bounces at modpython.org
[mailto:mod_python-bounces at modpython.org] On Behalf Of Nick
Sent: Monday, April 10, 2006 10:40 AM
To: Lee Brown
Cc: mod_python at modpython.org
Subject: Re: [mod_python] Speaking of Output Filters....

Sounds pretty cool... I haven't looked at the library modules you
referenced, but is it possible to create XSLT extension functions in Python
that your stylesheet can reference?

Thanks,
Nick

Lee Brown wrote:
> 
> 
> Greetings!
> 
> I am probably remiss for not having shared this before now.  Here are 
> two output filters for mod_python that I have developed.
> 
> The first filter, xsltfilter.py, transforms XML into XHTML (or 
> whatever else you may desire) via an XSLT template.  The second 
> filter, xincludefilter.py, processes xinclude elements imbedded in 
> XHTML.  Both are meant as a simple means of providing "quasi-dynamic" web
content.
> Benchmarks on my hardware show throughputs of 100 to 500+ pages per 
> second using these filters.
> 
> Dependencies:
> lxml:  an ElemenTree-like binding for the libxml2/libxslt libraries 
> (see http://www.codespeak.net/lxml <http://www.codespeak.net/lxml> )

[code and examples deleted]
_______________________________________________
Mod_python mailing list
Mod_python at modpython.org
http://mailman.modpython.org/mailman/listinfo/mod_python



More information about the Mod_python mailing list