O'Reilly logo

Java™ Phrasebook by Timothy Fisher

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Transforming XML with XSLT

StreamSource input =
											new StreamSource(new File("document.xml"));
											StreamSource stylesheet =
											new StreamSource(new File("style.xsl"));
											StreamResult output =
											new StreamResult(new File("out.xml"));
											TransformerFactory tf =
											TransformerFactory.newInstance();
											Transformer tx = tf.newTransformer(stylesheet);
											tx.transform(input, output);

XSLT is a standard for transforming XML documents from one format to another using an XSL stylesheet. The javax.xml.transform package is the API for using the XSLT transformation standard in Java. XSL stands for Extensible Stylesheet Language. XSLT is XSL Transformation, and it allows you to completely restructure an XML document. In general, when using XSLT, you have an input XML document and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required