The reason it fails is that when it's a Source its concept of
a location depends on how its created - if its reading from a
file on disk then the location is known, if its reading from
memory then it doesnt have a location, so you have to provide
one with setSystemId().
If the Source was created using a File then the systemId is
taken from the File (which is why it worked then), but as the
code was modified to use urlConn.getInputStream() the
systemId gets lost, which is why you have to set it manually.
Ah - I get you. I've never encountered this before.
It's better now but still not working.
It still seems to be confused. Remember I am passing it an http:// url
to a
an XSL file which does a
<xsl:include href="Common.xsl"/>
the responsse is...
========================================================================
====================
DEBUG : XSLTUtils.newTransformer(http://<ip
address>:8080/lisa/jnlp/TestXLST2.0.xsl)
Error at xsl:include on line 6 of file:///lisa/jnlp/TestXLST2.0.xsl:
XTSE0165: java.io.FileNotFoundException: \lisa\jnlp\Common.xsl (The
system cannot find the
path specified)
Problem loading XSLT: Failed to compile stylesheet. 1 error detected.
No params specified
========================================================================
====================
It seems to be going from http: to file: and missing the server path.
I expect I'm doing something cockeyed.
Here's my change code...
public static synchronized Transformer newTransformer(String
xsltUrl) throws
TransformerConfigurationException {
URL url = new URL(xsltUrl);
<blah blah blah>
InputStream is = urlConn.getInputStream();
Source xslSource = new StreamSource(is);
xslSource.setSystemId(xsltUrl); /////////// NEW NEW NEW
NEW
TransformerFactory transFact =
TransformerFactory.newInstance();
Templates templates = transFact.newTemplates(xslSource);
I tried the
xslSource.setSystemId(url.getPathI());
but that had similar problems (although it was still "more right" than
before)
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--