http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Overview

Compiler design

Whitespace
xsl:sort
Keys
Comment design

lang()
Unparsed entities

If design
Choose|When|Otherwise design
Include|Import design
Variable|Param design

Runtime

Internal DOM
Namespaces

Translet & TrAX
XPath Predicates
Xsltc Iterators
Xsltc Native API
Xsltc TrAX API
Performance Hints

Credits

The JAXP/TrAX API
 

XSLTC is 100% compliant with the TrAX poriton of the JAXP API. This API is a standard extension to Java and there is not much point in describing it in detail in this document.


XSLTC's extensions to JAXP/TrAX
 

The Source and Result classes within TrAX are used to handle input and output documents. These classes can be extended to encapsulate additional input types. XSLTC's TrAX implementation contains an extension to the Source class:

    org.apache.xalan.xsltc.trax.XSLTCSource

This extension class can be used to build and encapsulate XSLTC's internal DOM and DTD handler:

    public void run(String xmlfile, String xslfile) {

        // Set up your factory classes
        SAXParserFactory factory = SAXParserFactory.newInstance();
        TransformerFactory factory = TransformerFactory.newInstance();

        try {
            // Create a namespace-aware parser
            try {
                factory.setFeature(Constants.NAMESPACE_FEATURE,true);
            }
            catch (Exception e) {
                factory.setNamespaceAware(true);
            }
            final SAXParser parser = factory.newSAXParser();
            final XMLReader reader = parser.getXMLReader();

            // Build an XSLTCSource for the input XML document
            XSLTCSource source = new XSLTCSource();
            source.build(reader, xmlfile);

            // Build a StreamSource for the stylesheet
            StreamSource stylesheet = new StreamSource(xslfile);

            // Create a Transformer instance and process the input
            Transformer transformer = factory.newTransformer(stylesheet);
            transformer.transform(source, new StreamResult(System.out));
        }
	:
	:
    }

If you do chose to implement a DOM cache, you should have your cache implement the javax.xml.transform.URIResolver interface so that documents loaded by the document() function are also read from your cache.



Copyright © 2003 The Apache Software Foundation. All Rights Reserved.