xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Samson, Lyndon [IT]" <lyndon.sam...@ssmb.com>
Subject RE: Xalan 2.0.0
Date Tue, 13 Mar 2001 17:47:55 GMT
Wow, quick turnaround, thanks Scott and Kelly, I think you guys should be
asking for a raise :-)


-----Original Message-----
From: Kelly Campbell [mailto:camk@merlot.channelpoint.com]
Sent: Tuesday, March 13, 2001 5:33 PM
To: general@xml.apache.org
Subject: Re: Xalan 2.0.0


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
resolvers.

-Kelly
-- 
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

---------------------------------------------------------------------
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


Mime
View raw message