@Test public void test_xslt_result() throws IOException, SAXException { Transformer transformer = getTransformer("xslt-config-03.xml"); DefaultMessage message = newMessage(INITIAL); transformer.transform(message); String result = message.getContent(String.class); XMLUnit.setIgnoreWhitespace(true); Diff diff = new Diff(EXPECTED, result); Assert.assertTrue(diff.toString(), diff.identical()); }
@Override public Message transform(Message message) { javax.xml.transform.Transformer transformer = null; try { DOMSource source = message.getContent(DOMSource.class); DOMResult result = new DOMResult(); if (_transformerPool != null) { transformer = _transformerPool.take(); } else { transformer = _templates.newTransformer(); transformer.setErrorListener(new XsltTransformerErrorListener(_failOnWarning)); } transformer.transform(source, result); message.setContent(((Document)result.getNode()).getDocumentElement()); } catch (Exception e) { throw TransformMessages.MESSAGES.errorDuringXsltTransformation(e); } finally { if (_transformerPool != null && transformer != null) { _transformerPool.give(transformer); } } return message; }
XsltTransformer extends BaseTransformer<Message, Message> { @Override public Message transform(Message message) { javax.xml.transform.Transformer transformer = null; try { DOMSource source = message.getContent(DOMSource.class); DOMResult result = new DOMResult(); if (_transformerPool != null) { transformer = _transformerPool.take(); } else { transformer = _templates.newTransformer(); transformer.setErrorListener(new XsltTransformerErrorListener(_failOnWarning)); } transformer.transform(source, result); message.setContent(((Document)result.getNode()).getDocumentElement()); } catch (Exception e) { throw TransformMessages.MESSAGES.errorDuringXsltTransformation(e); } finally { if (_transformerPool != null && transformer != null) { _transformerPool.give(transformer); } } return message; } }
XsltTransformer extends BaseTransformer<Message, Message> { @Override public Message transform(Message message) { javax.xml.transform.Transformer transformer = null; try { DOMSource source = message.getContent(DOMSource.class); DOMResult result = new DOMResult(); if (_transformerPool != null) { transformer = _transformerPool.take(); } else { transformer = _templates.newTransformer(); transformer.setErrorListener(new XsltTransformerErrorListener(_failOnWarning)); } transformer.transform(source, result); message.setContent(((Document)result.getNode()).getDocumentElement()); } catch (Exception e) { throw TransformMessages.MESSAGES.errorDuringXsltTransformation(e); } finally { if (_transformerPool != null && transformer != null) { _transformerPool.give(transformer); } } return message; } XsltTransformer(QName from, QName to, Templates templates, boolean failOnWarning, int maxPoolSize); }
XsltTransformer extends BaseTransformer<Message, Message> { @Override public Message transform(Message message) { javax.xml.transform.Transformer transformer = null; try { DOMSource source = message.getContent(DOMSource.class); DOMResult result = new DOMResult(); if (_transformerPool != null) { transformer = _transformerPool.take(); } else { transformer = _templates.newTransformer(); transformer.setErrorListener(new XsltTransformerErrorListener(_failOnWarning)); } transformer.transform(source, result); message.setContent(((Document)result.getNode()).getDocumentElement()); } catch (Exception e) { throw TransformMessages.MESSAGES.errorDuringXsltTransformation(e); } finally { if (_transformerPool != null && transformer != null) { _transformerPool.give(transformer); } } return message; } XsltTransformer(QName from, QName to, Templates templates, boolean failOnWarning, int maxPoolSize); @Override Message transform(Message message); }
XsltTransformer extends BaseTransformer<Message, Message> { @Override public Message transform(Message message) { javax.xml.transform.Transformer transformer = null; try { DOMSource source = message.getContent(DOMSource.class); DOMResult result = new DOMResult(); if (_transformerPool != null) { transformer = _transformerPool.take(); } else { transformer = _templates.newTransformer(); transformer.setErrorListener(new XsltTransformerErrorListener(_failOnWarning)); } transformer.transform(source, result); message.setContent(((Document)result.getNode()).getDocumentElement()); } catch (Exception e) { throw TransformMessages.MESSAGES.errorDuringXsltTransformation(e); } finally { if (_transformerPool != null && transformer != null) { _transformerPool.give(transformer); } } return message; } XsltTransformer(QName from, QName to, Templates templates, boolean failOnWarning, int maxPoolSize); @Override Message transform(Message message);  }