xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kelly Campbell <c...@merlot.channelpoint.com>
Subject Re: Xalan 2.0.0
Date Tue, 13 Mar 2001 17:32:37 GMT
On Tue, Mar 13, 2001 at 05:10:48PM -0000, Samson, Lyndon [IT] wrote:
> The w3c docs say that the included files are relative to the base URI, that
> is
> the URI of the top level document.
> I have some simple code which looks like this
> 	StreamSource s = ...; // Some Streamsource
> 	TransformerFactory tFactory = TransformerFactory.newInstance();
>       Transformer transformer = tFactory.newTransformer(new StreamSource(new
> FileReader("/dir1/dir2/toplevel.xsl")));
>       StringWriter xmlOut = new StringWriter();
>       transformer.transform(s, new StreamResult(xmlOut));

The base URI for a stream can't be determined from the above code because you
pass a Stream object. If you create the StreamSource with a system ID file url
such as new StreamSource("file:///dir1/dir2/toplevel.xsl") it should be able
to find the included stylesheets relative to the toplevel one.

For more complex situations you could provide a URIResolver to the factory:

	    TransformerFactory factory = TransformerFactory.newInstance();
	    factory.setURIResolver(new MySpecialURIResolver());

See the javax.xml.transform API docs for more information on these URI

Kelly A. Campbell              Software Engineer
<camk@merlotxml.org>           ChannelPoint, Inc.
<camk@channelpoint.com>        Colorado Springs, Co.

In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org

View raw message