morphis logo morphis | wax   
morphis manual
manual
 

Processing
   Dispatching
   Requesting
   Translating

Installation
   Requirements
   Instructions
   Config Properties

Dispatching
   Configuration
   Pre/Post Filters

Requestors
   URL Requesting
   Servlet Chaining
   Run-time Instructs
   Custom Requestors

Translators
   Non-Translator
   Custom Translators

SAX Translators
   XSLT Translation
   Custom SAX Filters

Translators: Overview

Translators provide a means of converting a stream provided by a Requestor (the input stream), to another stream to be returned to the requesting device (the output stream). Translators can be written to do things like image scaling, color conversion, markup tag replacement, and XML conversion. Morphis provides two built-in translators, the NonTranslator for pass-through filtertering, and the SAX Translator for performing translation on XML streams (or, even HTML streams). Only one Translator is associated with a request, however, translators can be built to perform translation in multiple stages.

The built-in SAX Translator is capable of performing XSL transformations as defined by the W3C at http://www.w3.org/Style/XSL/. This type of transformation is able to turn an HTML or XML stream into a vastly different HTML or XML stream based on a set of translation rules. Morphis uses Apache Xalan XSLT processor, and Xerces XML parser to perform XSLT transformation.

The translator tag in dispatch.xml is used to define translators. The filter tag inside of a translator enumerates different steps performed in the translation. Each filter may have a parameter associated with it. The implementation of filters and parameters is dependent on the Translator. Filters are ususually reserved for "advanced" Translators, and these tags are not required. The SAX Translator works in this fashion.

<context ...>
    ...
    <translator class="...translator class...">
            <filter type="filter type" class="...filter class...">
                <parameters>
                    <param name="..." value="..."/>
                </parameters>
            </filter>
     </translator>

</context>

More about Translators:

Non-Translator

Writing Custom Translators

Since it plays such an important role in Morphis, an entire section has been devoted to the SAX Translator.

morphis SourceForge Logo