XSLT Servlet
This servlet transforms an XML document using an XSLT stylesheet. Probably there are other Servlet implementations of this kind, but I couldn’t find one with the features I need available under an Open Source license, so I wrote this one.
Features
- the XML document and the stylesheet can be retrieved from the local webapp or from the network (using
java.net). - Stylesheet is preloaded at startup and then periodically reloaded in the background in order to optimize performance.
- JSP EL expressions can be used in the Servlet init params.
- Parameters can be passed to the stylesheet.
- XSLT output properties can be controlled by the Servlet.
- Not tied to a specific XML parser or XSLT processor.
This Servlet usesjavax.xml.transform(aka TrAX) for XSLT processing.
This is a sample web.xml configuration:
<servlet>
<servlet-name>myTransformation</servlet-name>
<servlet-class>it.kataweb.xslt.servlet.XSLTServlet</servlet-class>
<init-param>
<param-name>xml</param-name>
<param-value>http://domain.org/service?param=${param.myParam}</param-value>
</init-param>
<init-param>
<param-name>xslt</param-name>
<param-value>/WEB-INF/xslt/myStylesheet.xslt</param-value>
</init-param>
<init-param>
<param-name>xsltReloadInterval</param-name>
<param-value>60</param-value>
</init-param>
</servlet>
For reference documentation see the Javadocs included in the distribution.
Legal
This Servlet is Open Source software distributed under the Apache License Version 2.0.
Requirements
Download
- Published:
- Giugno 23, 2005
- Category:
- Java, My software projects
1 Comment
Jump to comment form | comments rss [?] | trackback uri [?]