Custom Language Modules
AxKit Language modules provide various ways to transform XML content during delivery. For example, Apache::AxKit::Language::XSP provides AxKit’s eXtensible Server Pages implementation, while Apache::AxKit::Language::LibXSLT is one of two Language modules that offers the ability to transform content using XSLT stylesheets. Usually, a Language module is simply a wrapper around the implementation of proven or promising XML transformation technology that allows AxKit to pass data to that processor and capture the result for delivery or further processing.
New Language modules are added to AxKit at runtime using the
AxAddStyleMap directive. This directive requires
two arguments: the MIME type used to associate transformations with
the given Language processor and the Perl package name of the module
that implements that processor:
# Add the Language module AxAddStyleMap application/x-mylang Language::MyCustomLanguage # Then, later, an AddProcessor directive that uses your new Language to apply # the 'default.mlg' stylesheet AxAddProcessor application/x-mylang /styles/default.mlg
Language API
The Language module interface consists of a single
handler method expected to encapsulate the entire transformation process. This method is passed, in order: the current Apache object, a reference to the ContentProvider that will pull (or has pulled) in the original XML source, a reference to the StyleProvider that the Language module can use to get sources for any stylesheet to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access