[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Calling Saxon from a CGI script


Subject: RE: [xsl] Calling Saxon from a CGI script
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 20 Jun 2007 09:17:20 +0100

> I am using the Saxon processor for java to transform an XML 
> into HTML. The XSL expects the user to provide two parameter 
> values as command line arguments to Saxon. So, my call to 
> Saxon is something like this:
> >java net.sf.saxon.Transform -o report.html report.xml report.xsl
> >param1=val1 param2=val2
> 
> The values val1 and val2 are inputs in an HTML form and would 
> be available at run-time in a CGI perl script. Once I get 
> these values, I basically want to call Saxon as above to 
> perform the transformation. I am trying to use the 'system' 
> command inside the CGI perl script 

You really don't want to do it that way. Loading and initializing a Java VM
just to run one transformation is not the way to do things in a web service
environment. (It can take 5 seconds to load the VM to run a 50ms
transformation.) Write a Java servlet that runs in a container such as
Tomcat which keeps the VM alive, and use the JAXP API to drive the
transformations. There's a "starter kit" servlet for doing this in the Saxon
distribution.

> but it doesn't work - I am 
> seeing the following error in the webserver error logs:
> 
> *** glibc detected *** java: free(): invalid pointer: 0xbfc7cbb8 ***,

Sorry, that's not an XSLT or Saxon problem, it's something to do with the
configuration of your web server.

Michael Kay
http://www.saxonica.com/


Current Thread
Keywords