Interfacing XT to Java

You can also interface the XT processor to Java. The XT API is designed to interface easily with the classes defined in Sun’s Project X TR2, which supports XML handling. You need the file xml.jar from Sun, which you can get by downloading Sun’s Project X TR2. You need to be a member of Sun’s developer site, http://developer.java.sun.com, to get xml.jar. Fortunately, becoming a member is free, but you have to fill out a number of forms at http://developer.java.sun.com.

You need xml.jar for the com.sun.xml.tree.XmlDocumentclass. This class supports XML documents, and I start this new example, xtjava.java, by creating a new XmlDocument object for the source document, the XSLT stylesheet, and the result document:

 import java.io.IOException; ...

Get Inside XSLT 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.