public void XmlTransformation(OutputStream out, Document doc, String filename) throws XSLTransformException, IOException {
Document docTrans = new Document();
if (filename != null && filename.equals("")) {
XSLTransformer transformer;
transformer = new XSLTransformer(filename);
docTrans = transformer.transform(doc);
} else {
docTrans = doc;
}
Format format = Format.getPrettyFormat();
format.setEncoding("utf-8");