Java XSLT Filter
XSLT filter code has been moved to the Carrot2 codebase.
I needed an XSLT filter for a long time. These few solutions you can find on the Web are usually very simple — buffering of the servlet's output and preprocessing with a given XSLT stylesheet. My goal was to create something more advanced — a production-quality XSLT filter which could preprocess XML files with various xml-stylesheet directives, output methods and encodings, take into consideration processing errors and such. This is the result.
How to use it?
Define the filter in Web application descriptor (web.xml) and map it to any extension which should be processed. Something like this should do:
The filter processes only streams which send a proper MIME type (text/xml or application/xml) and define an xml-stylesheet header:
The 'href' attribute can be any of the following:
The stylesheet is cached in memory for subsequent use.