public void transform(InputStream xmlSourceStream, InputStream xslSourseStream, OutputStream resultStream) {
    try {
      Source xmlSource = new StreamSource(xmlSourceStream);
      Source xsltSource = new StreamSource(xslSourseStream);
      TransformerFactory transFact = TransformerFactory.newInstance();
      Transformer trans = transFact.newTransformer(xsltSource);
      trans.transform(xmlSource, new StreamResult(resultStream));
    } catch (TransformerException e) {
      e.printStackTrace();
    }
  }