*/
public String applyTemplate(String xml, InputStream template, String url) {
try {
final TransformerFactory factory = TransformerFactory.newInstance();
final Transformer transformer = factory.newTransformer(new StreamSource(template));
final DocumentSource source = new DocumentSource(DocumentHelper.parseText(xml));
final StringWriter sw = new StringWriter();
final StreamResult response = new StreamResult(sw);
transformer.setParameter("url", url);
transformer.transform(source, response);