|
|
||||||||||||||||||||||
|
| ||||||||||||||||||||||
Part 3 Java XML Programmers Reference Chapter 11: XML Tools for Information Appliances October 8, 2001
Package org.apache.xalan.xsltc There are no Javadocs for this package, but let's hope Apache changes this soon. The package contains the interfaces and classes used and implemented by translets. Remember that translets are compiled XSL stylesheets. The primary interfaces and classes in this package are:
We will discuss each of these in this section. Interface Translet
A class that implements interface Translet must be able to transform XML input into the output specified by the mapping in the original XSL stylesheet. The XSLTC library creates classes that implement this interface; you shouldn't ever need to write code that implements interface Translet. You will, however, need to call the transform() method to tell the implementing class when to begin the transformation process. The transform() Method
A transformation requires two items: a org.apache.xalan.xsltc.dom.DOMImpl object (which unfortunately carries no documentation!) and an object implementing the org.apache.xalan.xsltc.TransletOutputHandler interface. DOMImpl implements interface org.apache.xalan.xsltc.DOM. These two items are created in your application code and given to the translet. Arguments
Usage and Examples To create an instance of a class which implements org.apache.xalan.xsltc.Translet, we use the Java reflection API: Class cls = Class.forName("MyClass"); "MyClass" is the name of the class generated by XSLTC during compilation (we go over how to compile an XSL stylesheet in the section Example: Compiling and Using a Translet). xlet.transform() method can now be called to perform the transformation. Interface TransletOutputHandler
SAX 1.0 is supported by wrapping a org.apache.xalan.xsltc.runtime.TextOutput object around an object implementing TransletOutputHandler. Since SAX is the de facto push parser standard, we'll focus on how to use it with translets rather than the proprietary TransletOutputHandler. However, let's briefly examine some of TransletOutputHandler to further understand how translets work. Callback Methods
Although this isn't complete, you should immediately see the similarities between this interface and SAX 1.0's org.xml.sax.DocumentHandler and SAX 2.0's org.xml.sax.ContentHandler.
A helper class is given to us to enable SAX 1.0 support. org.apache.xalan.xsltc.runtime | ||||||||||||||||||||||
|
PAGE: 1 | 2 | 3 | 4 | 5 | 6 | NEXT PAGE |
||||||||||||||||||||||













