Accesing an already loaded applicaction bean from an XSLT transformation 2005-09-12 - By Victor Abeytua
Hi, In the project I'm currently involved, I'm trying to access an already loaded bean (application scope) from an XSLT transformation. The problem I've got is that if I use the java extensions of xalan, the transformer creates a "new" java Object, (it doesn't use the one it is already loaded). Probably, I would be able to solve it if I find the way of accessing the servlet context (but as I haven't been able I'm not sure about it either). The idea behind using this approach is to avoid parsing the i18n messages every time the xslt is called. Right now, my xslt file looks like:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xalan="http://xml.apache.org/xalan" xmlns:optionsb="lingua.beans.OptionsBean" extension-element-prefixes="optionsb" version="1.0" > <xsl:output method="html"/>
<xsl:param name="lang" select="'default value'"/> <xalan:component prefix="optionsb" elements="init incr" functions="readLang readCountry readLevel getMessageFromXslt"> <xalan:script lang="javaclass" src="lingua.beans.OptionsBean"/> </xalan:component>
BTW, I'm using tomcat 4.1 as servlet container and java 1.5.
Thanks in advance, Victor
Any ideas
|
|