libxslt, libxml and xmldoc problem

Brian Quinlan brian at sweetapp.com
Wed Aug 21 20:47:40 CEST 2002


Aseem Mohanty wrote:
> I read about Pyana on the Zope list, my only concern is, (since you
are
> the author, you would/should know) is Pyana stable enough for a
> production server  with 1000s of XML files and ~50 XSLT translations
per
> couple of seconds?

I believe so, yes. The core of Pyana's transformation engine is the
Apache Group's Xalan XSLT processor. Most Pyana features just rely on a
simple wrapper to bridge the Xalan C code to Python. However, I'll
suggest, for maximum performance and stability, that you avoid certain
Pyana features:

1. Don't extend XPath with Python functions (especially ones that use
complex types such as node sets and result tree fragments)
2. Transform directly to a string, file or writer objects i.e. don't
generate a DOM first and then serialize it yourself
 
Also, Pyana has a precompiling and preparsing step that you can use for
faster repeated transforms, e.g.

import Pyana

t = Pyana.Transformer()
parsedSource = self.t.parseSource(Pyana.URI("A_First_Scenario.xml"))
stylesheet = self.t.compileStylesheet(Pyana.URI("help_page.xsl"))
t.transform2String(parsedSource, stylesheet)

Keep in mind that experimenting with Pyana probably won't take very much
time, if you are using Windows.

Cheers,
Brian





More information about the Python-list mailing list