[mod_python] A PSP templating example with XML and XSLT

Lee Brown administrator at leebrown.org
Wed Aug 10 22:53:21 EDT 2005


Here is the problem:

<?xml-stylesheet type="text/xsl"

Some browsers (like IE6) recognize "text/xsl". Some browsers (like Opera)
recognize "application/xml".  Mozilla and Firefox recognize both types.  I
suspect that if you changed "text/xsl" to "application/xml" it would work on
Opera, Konqueror, and Safari.

In general, the acceptable MIME type for xslt stylesheets is inconsistent
across browser platforms at this time.  I have found that the only
consistent, fully cross-platform solution to delivering xml-based content is
to do a server-side xslt transformation of the xml into xhtml.

Apropos to mod_python and the 'list, there are several solutions available
for performing xslt transformations within a mod_python handler.  Pyana
provides a python class wrapper for the Apache Xalan-C xslt processor, there
is a python wrapper for libxslt floating around somewhere (seen it but never
tried it), and there is a pure-python xslt processor available in
FourThought's 4Suite.  I found Pyana to be fast and stable; you can find it
on Source Forge.

(Side Note: Oddly enough, the fastest xslt processor I've tried is the
Microsoft MSXML COM object.  You'd think that all of the PyWin32 COM
overhead would really slow things down, but it doesn't seem to.  Of course,
this knowledge is of little use unless you happen to be running Apache 2.0
under WinXP.)

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 Graham Dumpleton
Sent: Wednesday, August 10, 2005 6:45 PM
To: Martin P. Hellwig
Cc: mod_python at modpython.org
Subject: Re: [mod_python] A PSP templating example with XML and XSLT

You might try it on a range of browsers. Doesn't work properly with Safari
under Mac OS Panther. Doesn't seem to detect it as XML and thus simply
strips out all the markup and displays the bits left over as a big mess.
All I did was follow the link below, so don't think I am doing anything

On 10/08/2005, at 11:16 PM, Martin P. Hellwig wrote:

> Hello all,
> I only recently picked up python (as my first realer programming
> language) and made a test page with mod_python using  a own written 
> simple handler, psp templating with xml and xslt.
> There is a link to a page (right top corner) where  I describe how 
> I've done it plus all the source and directories. Maybe this is 
> interesting for people who like to have a more or less working example 
> of a mod_python site.
> See it at, http://xinagnet.xs4all.nl/browser_info
> If you have feedback on grammar, clearnes or coding please do tell me 
> (this list will do fine), thanks!
> --
> mph
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

Mod_python mailing list
Mod_python at modpython.org

More information about the Mod_python mailing list