Copyright by Michael Kay

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Appendix E. JAXP: The Java API for Transformation

JAXP is a Java API for controlling various aspects of XML processing, including parsing, validation, and XSLT transformation. This appendix concentrates on the transformation API. During its development this was known as TrAX (Transformation API for XML) — you will still see this term used occasionally.

JAXP is well supported by all the Java XML processors. The benefit of JAXP is that it allows you to write Java applications that invoke XSLT transformations without committing your application to a particular XSLT processor. At one time, there were five different Java processors you could choose from (xt, Saxon, Xalan, Oracle, or jd.xslt) but for most people now the choice has whittled down to Xalan and Saxon (though both these products have a choice of processors within the same product family). JAXP works so well that I have come across users who were running Saxon when they thought they were using Xalan, or vice versa. It's a good idea to include the following instruction in your initial template so that you avoid this mistake:

<xsl:comment>
   Created using <xsl:value-of select="system-property("xsl:vendor')'/>
</xsl:comment>

The version numbers for JAXP are irritatingly out of sync with those of the JDK. The following table shows the correspondence:

JAXP version

JDK version

New Functionality

1.2

JDK 1.4

XML Parsing (SAX and DOM) and Transformation

1.3

JDK 1.5 (Java 5)

Schema processing; XPath processing; DOM level 3

1.4

JDK 1.6 (Java 6)

Pull parsing ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required