Hallo,
I'm trying to porting an old application which uses an old version of Xalan to a newer which uses Xalan 2.6.0.
That old application instantiates an XSLTEngine object in a servlet Java, then passes this object as parameter to a stylesheet.
The code that does this is:


try {
this.xsltproc.reset();
this.xsltproc.setTraceSelect(true);
this.xsltproc.setTraceTemplates(true);
this.xsltproc.setDiagnosticsOutput(System.out);
this.xsltproc.setStylesheetParam("ttdb", _xslteng);
this.xsltproc.process(new XSLTInputSource(doc),
new XSLTInputSource(xsltfile),
new XSLTResultTarget(xml_sink));
} catch(SAXException e) {
docerr = -1;
docerrtext = "Error processing Stylesheet : " + e.getMessage();
System.out.println("ttprocessor servlet: could not process request. Error processing Stylesheet");
System.out.println("exception is " + e.getMessage()); }


where _xslteng is an XObject created passing the XSLTEngine object to XObject constructor, and xsltproc is an object of type org.apache.xalan.xslt.XSLTProcessor (which doesn't exixst in Xalan 2.6.0.??????.......)

Now, I use the following code:

Transformer transformer;
try
{
Templates templates = factory.newTemplates(new StreamSource(new File(xsltfile)));
transformer = templates.newTransformer();
transformer.setParameter("ttdb", xslteng);
DOMResult res = new DOMResult();
transformer.transform(new DOMSource(doc), res);
}
........................................................
Where xslteng is an object of type ttdblib.XSLTEngine


The xsl file is:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:java="http://xml.apache.org/xalan/java";
xmlns:eng="xalan://ttdblib.XSLTEngine"
version='1.0'>
<xsl:param name="ttdb"/>
<xsl:template match="/">
<xsl:apply-templates select="/message/OrdinativoImbarco"/>
</xsl:template>
<xsl:template match="OrdinativoImbarco">
<xsl:variable name="valore" select="eng:prova($ttdb)"/>
<p>Valore: <xsl:value-of select="string($valore)"/></p>
</xsl:template>


       </xsl:stylesheet>

When I run that program, I receive an error like this:
'METHOD_NOT_FOUND_ERR ttdblib.XSLTEngine:prova'
The method prova is public in the class XSLTEngine, and it returns a string.




Reply via email to