当然可以了.给你个例子开发一下思路
StreamSource xml = new StreamSource("你的xml文件");
StreamSource xsl = new StreamSource("你的xsl文件");
//response.setContentType("text/html; charset=UTF-8");
StreamResult result = new StreamResult(out);
Transformer trans = TransformerFactory.newInstance().newTransformer(xsl);
//java.util.Properties properties = trans.getOutputProperties();
//trans.setOutputProperty(OutputKeys.ENCODING,"GB2312");
trans.setOutputProperty(OutputKeys.METHOD,"html");
trans.setOutputProperty(OutputKeys.VERSION,"4.0");
//trans.setOutputProperty("encoding","UTF-8");
trans.transform(xml, result);
StreamSource xml = new StreamSource("你的xml文件");
StreamSource xsl = new StreamSource("你的xsl文件");
//response.setContentType("text/html; charset=UTF-8");
StreamResult result = new StreamResult(out);
Transformer trans = TransformerFactory.newInstance().newTransformer(xsl);
//java.util.Properties properties = trans.getOutputProperties();
//trans.setOutputProperty(OutputKeys.ENCODING,"GB2312");
trans.setOutputProperty(OutputKeys.METHOD,"html");
trans.setOutputProperty(OutputKeys.VERSION,"4.0");
//trans.setOutputProperty("encoding","UTF-8");
trans.transform(xml, result);
“你的xml文件”这里可以用XML流代替么?用STRINGBUFFER可以么?
我说可以就一定可以的,相信我没错的. 至于如何传数据流,你当然需要转化一下了