ByteArrayOutputStream baosForSource = new ByteArrayOutputStream();
XMLStreamWriter xsWriterForSource = XMLOutputFactory.newInstance().createXMLStreamWriter(baosForSource);
OMNode sourceNode = getTransformSource(synCtx);
log.debug("Transformation source : " + sourceNode);
sourceNode.serialize(xsWriterForSource);
Source transformSrc = new StreamSource(new ByteArrayInputStream(baosForSource.toByteArray()));
// create a new Stream result over a new BAOS..
ByteArrayOutputStream baosForTarget = new ByteArrayOutputStream();
StreamResult transformTgt = new StreamResult(baosForTarget);