Posted By:
Eelco_Cramer
Posted On:
Friday, October 26, 2001 08:23 AM
I'm having difficulties with the following code (I'm probably doing something wrong): String xml1 = "xml2.xml"; String xml2 = "xml2.xsl"; String xsl = "xsl.xsl"; TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(new StreamSource(xslt1)); PipedOutputStream pos = new PipedOutputStream(); PipedInputStream pis = new PipedInputStream(pos); transformer.transform(new StreamSource(xml1), new StreamResult(pos)); transformer = tFactory.newTransformer(new StreamSource(pis)); transformer.transform(new StreamSource(xml2),ne
More>>
I'm having difficulties with the following code (I'm probably doing something wrong):
String xml1 = "xml2.xml";
String xml2 = "xml2.xsl";
String xsl = "xsl.xsl";
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new StreamSource(xslt1));
PipedOutputStream pos = new PipedOutputStream();
PipedInputStream pis = new PipedInputStream(pos);
transformer.transform(new StreamSource(xml1), new StreamResult(pos));
transformer = tFactory.newTransformer(new StreamSource(pis));
transformer.transform(new StreamSource(xml2),new StreamResult(out));
Okay, what am I trying to do here :)
I'm using a XSL to transform xml1 to a new XSL which I want to use to transform xml2. Because the transformer has a StreamResult and the second transformer uses a StreamSource I have to pipe the two. I'm using PipeStreams to do that, but I'm using them wrong :-). I reckon I have to use some sort of Thread but I'm not really into Threads, does anyone have a suggestion?
<<Less