Thanks - that was the hint I needed....
 
I recompiled Saxon with extra debugging output (stack trace) and this helped me to discover that it was hiding an excpetion from deep inside the XML parser related to encoding.
 
I then discovered a UTF8 encoding problem I was missing in the WebLogic logs (staring at it too long).
 
It turns out you need to specify the JSP encoding in some obscure WebLogic setting.
Now we're getting there!
 
Thanks again,
 
    Kev
 
 
-----Original Message-----
From: Michael Kay [mailto:michael.h.kay@ntlworld.com]
Sent: 21 November 2001 17:46
To: Kevin A. Palfreyman; 'Saxon-Help (E-mail)'
Subject: RE: [saxon] TrAX with a jar: URL

I would try to get it working without <?xml-stylesheet?> initially, using a standard StreamSource or SAXSource for both the XML and stylesheet documents. This will reveal whether the problem is specific to getAssociatedStylesheet() - the latter is a messy method because of the need to read the same source file twice, quite apart from having to resolve the relative URI in the href pseudo-attribute. If you can get it working that way, try using the document() function to access relative URIs within the WAR file; put in your own URIResolver if necessary to see what's going on, and if necessary to customize the URI resolution logic.
 
It's just possible that there really is an XML parsing failure! For example, this might be due to encoding problems.
 
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: 21 November 2001 15:57
To: Saxon-Help (E-mail)
Subject: [saxon] TrAX with a jar: URL

I posted to the list last week ("Finding an XSLT inside a WAR") regarding a problem using Saxon with WebLogic... and I'm still having problems.  Briefly, I'm attempting to use TrAX to apply XSLT to _dynamically_ generated XML in WebLogic. (This code works in other application servers that are known to unpack the WAR.)

For now we can ignore the fact that it is a WAR - just think JAR (with a different name).


When I ask WebLogic for the path of the servlet I'm currently executing in (using ServletContext getResource() ), I get back a URL of the form:

        zip:C:/bea/local-path/web-app.war!/index.jsp
So this is a URL pointing at something inside a WAR file. 

Now that should be OK because I can convert that into a nice JDK1.2 or greater compatible JAR URL (without the final file):

        jar:file:///C:/bea/local-path/web-app.war!/
Which should work with java.net.JarURLConnection.

I then use this string with org.xml.sax.InputSource for the setSystemId(String systemId) method.

Unfortunately when I then pass that object to a TransformerFactoryImpl to get the associated stylesheet it still fails with a "TransformerConfigurationException: XML parsing failure while looking for <?xml-stylesheet?>"

See the following simplified code fragment....

// baseURI = "jar:file:///C:/bea/local-path/web-app.war!/"
// inStream is a BufferedInputStream
InputSource xmlInputSource = new InputSource(inStream);
SAXSource xmlSource = new SAXSource(xmlParser, xmlInputSource);
xmlSource.setSystemId(baseURI);
TransformerFactoryImpl factory    = new TransformerFactoryImpl();
Source styleSheet = factory.getAssociatedStylesheet(xmlSource,
        agentToken, null, null);


So - has anyone managed this before?  Either with a WAR, or presumably the same problem applies when the code and the XSLT's are packed in a JAR.

Any ideas appreciated.

Thanks

        Kev

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