Properties output = _stylesheet.getOutputProperties();
com.caucho.vfs.StringWriter sw = new com.caucho.vfs.StringWriter();
WriteStream ws = sw.openWrite();
XmlPrinter out = new XmlPrinter(ws);
out.setMethod((String) output.get(OutputKeys.METHOD));
out.setEncoding("UTF-8");
out.setMimeType((String) output.get(OutputKeys.MEDIA_TYPE));
String omit = (String) output.get(OutputKeys.OMIT_XML_DECLARATION);
if (omit == null || omit.equals("false") || omit.equals("no"))
out.setPrintDeclaration(true);
out.setStandalone((String) output.get(OutputKeys.STANDALONE));
out.setSystemId((String) output.get(OutputKeys.DOCTYPE_SYSTEM));
out.setPublicId((String) output.get(OutputKeys.DOCTYPE_PUBLIC));
String indent = (String) output.get(OutputKeys.INDENT);
if (indent != null)
out.setPretty(indent.equals("true"));
out.setVersion((String) output.get(OutputKeys.VERSION));
if (node instanceof CauchoNode) {
String filename = ((CauchoNode) node).getFilename();
out.setLineMap(filename != null ? filename : "anonymous.xsl");
}
else
out.setLineMap("anonymous.xsl");
String includeContentType = (String) output.get("include-content-type");
if (includeContentType != null)
out.setIncludeContentType(includeContentType.equals("true") ||
includeContentType.equals("yes"));
try {
out.startDocument();
_stylesheet.transform(node, out, this);
out.endDocument();
_lineMap = out.getLineMap();
ws.close();
return sw.getString();
} catch (Exception e) {
throw new IOExceptionWrapper(e);