Java API for XML (JAXP) – XSLT Transformation

XSLT Introduction

XSLT is the language for transforming XML documents into other documents such as HTML or other XML documents. It is part of the XSL or XML Schema language. The input to the transformation is a source tree and the output is the result tree. It uses predefined templates to match parts of the source document. The matched parts are then converted to the result document


JAXP provides classes that define the transformation API. i.e. It specifies a transformer factory that can be used to obtain a transformer. The transfomer takes in an XSL. The transformer has a transform method that converts the source tree to result tree. JAXP provides classes for the Source tree and the result tree


In this tutorial we look at using the JAXP classes that convert the XML to an HTML using an XSL. we show three examples that use a DOMSource, SAXSource and StAXSource respectively. The result tree will be printed on the console. The bbc.xsl file can be found here

Java API for XML (JAXP) – XSLT Transformation

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to top