| A holder for an XML Transformation source: a Document, Element, or list of
nodes.
The is provides input to a
javax.xml.transform.Transformer JAXP TrAX Transformer .
The following example shows how to apply an XSL Transformation
to a JDOM document and get the transformation result in the form
of a list of JDOM nodes:
public static List transform(Document doc, String stylesheet)
throws JDOMException {
try {
Transformer transformer = TransformerFactory.newInstance()
.newTransformer(new StreamSource(stylesheet));
JDOMSource in = new JDOMSource(doc);
JDOMResult out = new JDOMResult();
transformer.transform(in, out);
return out.getResult();
}
catch (TransformerException e) {
throw new JDOMException("XSLT Transformation failed", e);
}
}
See Also: org.jdom.transform.JDOMResult version: $Revision: 1.1 $, $Date: 2005/04/27 09:32:43 $ author: Laurent Bihanic author: Jason Hunter |