I haven't run into this exact problem, but I was having a similar problem using 'getRealPath' to create a file URL and then trying to access a file via that URL within the Websphere application server.  I found that I had to use the ServletContext method 'getResource' which returns a URL that can access the file or 'getResourceAsStream' if you need an InputStream for the file.  These methods provide a server independent way to access resources/files within a WAR/EAR.
-----Original Message-----
From: Michael Kay [mailto:michael.h.kay@ntlworld.com]
Sent: Thursday, November 15, 2001 9:31 AM
To: 'Kevin A. Palfreyman'; saxon-help@lists.sourceforge.net
Subject: RE: [saxon] Finding an XSLT inside a WAR

I'm afraid I'm out of my depth with WARs and EARs.
 
Mike Kay
-----Original Message-----
From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net]On Behalf Of Kevin A. Palfreyman
Sent: 15 November 2001 17:10
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Finding an XSLT inside a WAR

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.
e.g.
<?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)

Thanks,

        Kev


---
Dr. Kevin Palfreyman 
Apama (UK) Ltd