该构造
public StreamSource(String systemId)
从URL构造StreamSource。我认为您正在传递XSLT的内容。试试这个:
File xslFile = new File("path/to/your/xslt");TransformerFactory factory = TransformerFactory.newInstance();Templates xsl = factory.newTemplates(new StreamSource(xslFile));你还必须设置
OutputStream你的
StreamResult意愿写:
ByteArrayOutputStream baos = new ByteArrayOutputStream();Result result = new StreamResult(baos);transformer.transform(xmlInput, result);return baos.toString();



