何らかの理由で、以下のコードで例外が発生します。javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
public String removePrettyPrint(String xml) throws TransformerException, TransformerFactoryConfigurationError {
String result = "";
TransformerFactory factory = TransformerFactory.newInstance();
String source = "<?xml version=\"1.0\"?><xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"> <xsl:output indent=\"no\" /> <xsl:template match=\"@*|node()\"> <xsl:copy> <xsl:apply-templates select=\"@*|node()\"/> </xsl:copy> </xsl:template></xsl:stylesheet>";
Source xslt = new StreamSource(source);
Transformer transformer = factory.newTransformer(xslt);
Source text = new StreamSource(xml);
transformer.transform(text, new StreamResult(result));
return result;
}
それの何が問題なのですか?