public static void xsltConvert(String xmlSourceFile,
String xsltSourceFile,
OutputStream out) {
try {
File xmlFile = new File(xmlSourceFile);
File xsltFile = new File(xsltSourceFile); Source xmlSource = new StreamSource(xmlFile);
Source xsltSource = new StreamSource(xsltFile);
Result result = new StreamResult(out); TransformerFactory transFact = TransformerFactory.newInstance();
Transformer trans = transFact.newTransformer(xsltSource);
//给参数传递值
//trans.setParameter("image","B.jpg");
//trans.clearParameters();
trans.transform(xmlSource, result);
} catch (Exception ex) {
ex.printStackTrace();
}
}
String xsltSourceFile,
OutputStream out) {
try {
File xmlFile = new File(xmlSourceFile);
File xsltFile = new File(xsltSourceFile); Source xmlSource = new StreamSource(xmlFile);
Source xsltSource = new StreamSource(xsltFile);
Result result = new StreamResult(out); TransformerFactory transFact = TransformerFactory.newInstance();
Transformer trans = transFact.newTransformer(xsltSource);
//给参数传递值
//trans.setParameter("image","B.jpg");
//trans.clearParameters();
trans.transform(xmlSource, result);
} catch (Exception ex) {
ex.printStackTrace();
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货