Hi,
During transformation of my XSLT I needs to fetch data from method named *"myMethod(String str)"*, which is in *"mypackage.test.MyClass"* class. MyClass is in{color:#000000}
XXX.jar. {color}
This XXX.jar is not in context of my web application.*
Following is part of XSLT which I am using.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:aaa="mypackage.test.MyClass">
<xsl:template match="/responseData">
<xsl:for-each select="response">
<XMLResponse>
<xsl:for-each select="status">
<xsl:variable name="Vvar_ResResponseType" select="."/>
<xsl:attribute name="ResResponseType">
<xsl:value-of select="aaa:myMethod($Vvar_ResResponseType)"/>
</xsl:attribute>
</xsl:for-each>
</XMLResponse>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
So I tried to use reflection API to load XXX.jar file at runtime.
But while transforming Transformer does not find "myMethod(String str)" and gives error like "Could not compile stylesheet"
Following is full exception stacktrace
ERROR: 'The first argument to the non-static Java function 'myMethod' is not a valid object reference.'
FATAL ERROR: 'Could not compile stylesheet'
javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:829)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:623)
at com.actl.dxchange.utilities.Transformation.transform(Transformation.java:83)
at com.actl.dxchange.base.BaseConnector.transform(BaseConnector.java:330)
at com.actl.dxchange.connectors.KuoniConnector.doRequestProcess(KuoniConnector.java:388)
at com.actl.dxchange.connectors.KuoniConnector.hotelAvail(KuoniConnector.java:241)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
...........
Please suggest is there any other way, so that Transformer can find required bean class from XXX.jar duruing transformation process.
Thanks & Regards,
Rohit Lad
Edited by: Rohit_Lad on Jan 29, 2009 7:38 PM
Edited by: Rohit_Lad on Jan 30, 2009 9:57 AM
Edited by: Rohit_Lad on Jan 30, 2009 10:02 AM