Using XSLT in Java Applications
As you saw yesterday, JAXP provides a javax.xml.transform.Transformer class that is used to transform XML documents using XSLT. A javax.xml.transform.TransformerFactory is used to create a Transformer object. A new TransformerFactory object is created by the static newInstance() method in the factory class.
The following code creates a new TransformerFactory:
TransformerFactory factory = TransformerFactory.newInstance();
A Transformer object is created by a newTransformer() method in the factory object and optionally takes an XSLT stylesheet as a parameter to the method. The XSLT stylesheet must be accessed using a javax.xml.transform.stream.Source object. A StreamSource object can be constructed from a java.io.InputStream ...
Get Sams Teach Yourself J2EE™ in 21 Days, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.