[mod_python] 4XSLT/XML (4Suite) is not functioning correctly

Mongryong Mongryong at sympatico.ca
Mon Jan 13 02:14:39 EST 2003


I forgot to mention this, but the same problem also occurs when the
source XML document is a string (or a cString.StringIO).

For example:

p = Processor.Processor()
trans = InputSource.DefaultFactory.fromUri("someXSLTdoc.xsl")
src = cString.StringIO ()
someModule.makeXMLdoc(src)
p.appendStylesheet(trans)
res = p.run(src)

req.content_type="text/html"
req.write(res)

return apache.OK  

On Fri, 2003-01-10 at 12:54, Mongryong wrote:
> In my original script, I did include absolute paths.  I did not include
> the absolute paths in the email version of the script.  But even with
> the absolute path, I get the same 'empty' result.
> 
> On Fri, 2003-01-10 at 12:39, Gregory (Grisha) Trubetskoy wrote:
> > 
> > My first guess would be something relating to current directory. In true
> > CGI, the current directory is set to that of where the script is located.
> > Mod_python doesn't do this because changing directory is not a thread-safe
> > thing to do. I'd try it with absolute paths to the files.
> > 
> > Grisha
> > 
> > On 10 Jan 2003, Mongryong wrote:
> > 
> > > I've attached two files:
> > >
> > > cgi_result.html: the correct result as outputted by cgi/standalone
> > > version of my script
> > >
> > > modpython_result.html: the result as outputted by a mod_python version
> > > of my script
> > >
> > > >From the result, you should see that the html body is empty in modpython
> > > version.  I've done some tests with the mod_python version of my script
> > > and everything seems correct up to this point:
> > >
> > > res = p.run(src, topLevelParams={'error':0} )
> > >
> > > 'res' is the result of the transformation as a string.  The
> > > 'request.xsl' provides instructions to the XSLT engine on how to
> > > transform 'request.xml' to a HTML document.  No errors or exceptions are
> > > thrown.  It just seems as if the 'values' in 'request.xml' are NULL
> > > (empty) - hence, the body of the HTML is empty.
> > >
> > > Like I said previously, I've tried switching to a different XML/XSLT
> > > library (libxml2/libxslt from GNOME project) and I get the same result.
> > >
> > > On Fri, 2003-01-10 at 11:05, Gregory (Grisha) Trubetskoy wrote:
> > > >
> > > > On 10 Jan 2003, Kia Vang wrote:
> > > >
> > > > > Okay, I'm really frustrated.  My code seems very simple, yet I can't get
> > > > > mod_python to output it correctly.
> > > > >
> > > > > Here's the mod_python code:
> > > > >
> > > > > from Ft.Xml import InputSource
> > > > > from Ft.Xml.Xsl import Processor
> > > > >
> > > > > from mod_python import apache
> > > > >
> > > > > def handler(req):
> > > > > 	p = Processor.Processor()
> > > > > 	trans = InputSource.DefaultFactory.fromUri("request.xsl")
> > > > > 	src = InputSource.DefaultFactory.fromUri("request.xml")
> > > > > 	p.appendStylesheet(trans)
> > > > > 	res = p.run(src, topLevelParams={'error':0} )
> > > > >
> > > > > 	req.content_type="text/html"
> > > > > 	req.write(res)
> > > > >
> > > > > 	return apache.OK
> > > >
> > > > So what specifically is wrong with the above code's behaviour? What it is
> > > > supposed to do and what does it really do?
> > > >
> > > > Grisha
> > > >
> > > > _______________________________________________
> > > > Mod_python mailing list
> > > > Mod_python at modpython.org
> > > > http://www.modpython.org/mailman/listinfo/mod_python
> > >
> > >
> > 
> 
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python





More information about the Mod_python mailing list