Hi,
Sorry if this is a faq...
I have a custom uri resolver that I want to do a transform before passing the
result back to the requesting stylesheet. How do I go from a result to a
source? I can write the result out and then read it back in, says as a string
or bytes, but this seems unecessary... my knowledge of streams is really
lacking :(
code sample:
public Source resolve(String href, String base) throws TransformerException {
try {
URL context = new URL("file:///");
URL u = new URL(context, href);
InputStream is = new FileInputStream(u.toString());
TransformerFactory tf = TransformerFactory.newInstance();
Source xsl = new StreamSource(new
File("C:\\test\\AddElementIdToStylesheet.xsl"));
Result result = new StreamResult(???);
^^^what type of result do I need here?
Transformer transformer = tf.newTransformer(xsl);
transformer.transform(new StreamSource(is, u.toString()), result);
return ????;
^^^how do I return the result as a source?
} catch (Exception ex) {
System.out.println(ex.toString());
ex.printStackTrace();
}
return null;
}
cheers
andrew
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.467 / Virus Database: 266 - Release Date: 01/04/2003