Subject: RE: RE: URI Resolution for document('') Reference Is Broken?
From: "Houghton,Andrew" <houghtoa@xxxxxxxx>
Date: Wed, 6 Jan 2010 20:35:30 -0500
|
> From: Roger L. Cauvin [mailto:roger@xxxxxxxxxx]
> Sent: Wednesday, January 06, 2010 08:29 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: URI Resolution for document('') Reference Is Broken?
>
> Andrew Houghton wrote:
>
> > setSystemId value needs to be a file: URI not a file
> > system path.
>
> Tried that, too, and it didn't work:
This is what I did in a filter and it seems to work fine. Granted
its a filter rather than a servlet, but it shouldn't matter.
private ServletContext context;
String path = context.getRealPath(value);
File file = new File(path);
StreamSource src = new StreamSource(file);
src.setSystemId(file.toURI().toURL().toString());
log.info("transform location is " + path);
log.info("transform SystemId is " + src.getSystemId());
xf = tf.newTransformer(src);
Andy.
|