![]() |
morphis | wax | |||||
![]() |
||||||
SAX Translators: XSLT Translation using the XSLTAdapter FilterXSLT translation is used to translate one flavor of XML (or, SAX-ified versions of HTML) into either XML, or HTML. Morphis accomplishes this by wrapping Apache's Xalan product with the XSLTAdapter SAX Filter. This functionality treats XSLT processing just like any other SAX filter. In fact, you can chain all of these filters together to come up with a custom processing pipeline. Since the pipeline is SAX based, processing is fast, and requires less overhead than a traditional DOM based implementation. Many different scenarios are possible with this model. The following scenario performs XSLT processing on a document, then runs the result through two custom filters. The second filter is responsible for serializing the SAX events:
The followgin scenario performs two back-to-back XSLT transformations. The first XSLT processor generates XML, and the second XSLT processor generates an XML or HTML output stream:
Since the XSL stylesheet defines the rules for processing an XML document using XSLT, Morphis must be told which stylesheet to use, and where to find it. There are three different places this can happen:
Explaining XSL, and providing help building stylesheets is beyond the scope of this document. Fortunately, there are many websites which specialize in explaining XSL:
Java Extensions to XSLT One of the most powerful features of using Apache's Xalan to perform XSL translations is its Xalan-Java Extensions. Using these extensions you are able to embed scripting code directly into your XSL stylesheets. This functionality is similar to Java Server Pages "Tag Libraries", where your source HTML (or XML) document declares a tag (say, "<customer-table>") which is replaced by HTML (or XML) which is created by complex logic, database calls, Java beans, or any of the supported scripting languages. This logic can be written in your XSL stylesheet without having to compile code. Alternatively, you can write extension elements in Java which will invoke class methods whenever a defined element appears in your source document. This is very similar to writing custom Morphis SAX filters. To find out more information about writing custom extensions to XSL, see Apache's Xalan website at http://xml.apache.org/xalan/extensions.html. Currently, the list of supported scripting languages includes:
Explain: <xsl:output media-type="text/html"/>
|
||||||
![]() |