I have inherited some code which I need to maintain and I have hit a problem.

I have some JSP pages that dynamically generate XML, including PI to point at the XSLTs.
<?xml-stylesheet media="html" type="text/xsl" href="xslt/general.xslt"?>
<?xml-stylesheet media="wml" type="text/xsl" href="xslt/wml/general.xslt"?>

I also have a custom JSP tag that uses Saxon to transform the contained
XML and produce either HTML or WML or whatever (using TRaX).

Our web application is packaged in a WAR, and then inside an EAR.

In one application server (Orion) this works fine because it explodes the WAR
at deployment.  However, in WebLogic the WAR is not exploded.

This means that the following results in null
        servletPath = request.getServletPath();
        realPath = context.getRealPath(servletPath);  // this is null when in a WAR

The problem is that we had been using realPath to get the base directory for the
XSLT files - we were doing a setSystemID(...) on an instance of SAXSource
that had been created using the bytestream from the JSP.

However, when the SystemID is set to null, I get:
TransformerConfigurationException: XML parsing failure while looking for <?xml-stylesheet?>
at TransformerFactoryImpl.getAssociatedStylesheet(TransformerFactoryImpl.java:258)

I presume because it does not know the base for the relative path in PI.

Has anyone else used Saxon in a similar way and found a way around
this problem?

Please be gentle - I'm new to Saxon and programmatic transformations... :-)

(BTW normally using Saxon 6.3.x - 3 May 2001, but same result in 6.4.4)



Dr. Kevin Palfreyman 
Apama (UK) Ltd