mod_murka creates a convenient apache, xml, xsl based web publishing environment
mod_murka creates a convenient apache, xml, xsl based web publishing environment. It manages caching of static html pages and integrates nicely with Tomcat for dynamic pages to provide a flexible, high performance MVC development framework.
How does it work?
Murka is an apache module (mod_murka). It performs XML and XSL processing for both static and dynamic pages.
For static pages it intercepts an http request at a very early stage of apache request processing and if the requested file has .html type performs the following steps:
1. Checks if file exists. If it exists returns control to standard apache request processing.
2. If the file does not exist looks for xml file in the same directory and with the same name (but with .xml extension). For example if the request file had a name test.html the xml file name would be test.xml.
3. Processes the xml file to find the location of the corresponding xsl stylesheet.
4. Calls Xalan XSLT engine with found xml and xsl files as parameters to produce an html file.
5. Saves html file at the requested location (test.html in the sample case).
6. Returns control to apache
Next time when the same html file is requested it would exist as a plain html and no Murka processing would be necessary. The above procedure results in implicit html cache building for all requested html files. If any of the xml data files or presentation stylesheet xsl files changes, one just needs to delete the corresponding html file (clear cache) and Murka would build the updated html file automatically. Also Murka can automatically regenerate html files if xml data has been changed.
For dynamic pages it does a quick XML/XSL transformation of the XML content generated by java application and sends to a browser the resulting HTML page. That makes a full separation of business and presentation logic where java application (business logic) and presentation (XSL) can be developed by different people with practically no overlap and provides a nice alternative to jsps. The major advantage of this approach compared to doing XSL transformations in java is a huge performance gain due to much faster XSLT processing in C.
Dynamic stylesheet linking
One of the most important features of Murka is its ability to make a rule based association of a single xml and xsl file with multiple html files or a single xml file with multiple style sheets and multiple html files. Both scenarios are very common in web development. The first one occurs when there is some xml data and it should be displayed in a standard way but cached as separate html files for different subsets of xml data.
A standard example for a content publishing site would be multi page articles: it is natural to store the text of an article in a single xml file but each page should be cached as a separate html file. The second scenario is when the same content should be displayed in different styles, for example a page with a printable version of an article. To deal with both cases Murka uses a single rule: the dash (-) in a file name has a special meaning. If the file name in a URL contains dash Murka adds to steps 2 and 3 from the above list the following additional logic:
1. It takes the part of the file name before '-' and looks for an xml file with that name. If the xml file exists it uses this xml file, otherwise it tries the full name with '-' (so that to support meaningless '-' just as part of the filename).
2. It first looks for a stylesheet the name of which combines the name it finds in the xml file and the second (after '-') part of the file name in the URL. It uses this stylesheet if it finds it, otherwise it uses the "default" stylesheet defined in the xml file.
In both cases the value of the "after-dash" part of the file name is assigned to a special global variable with a name Sys_NamePar that is passed to the stylesheet and can be used there.
All that might sound complicated but it really is not. Murka comes with a fully functional example which shows how it works and explains everything in detail.
tags xml file the xml html file file name the file html files the same xml data dynamic pages file with single xml xml and looks for
Download mod_murka 0.8
Other software in this category
- Desktop Environment
- Science and Engineering
- Text Editing&Processing