ashish sharma
ashish sharma

Reputation: 15

error: Cannot find a matching 0-argument function with XSLT 2.0 with Saxon EE( with License File in Place in same folder that of JAR)

I am Using saxon EE processor for conversion of XML with XSLT-2.0. but its giving error for XSL file .

Below is the Code for XSL File

    <?xml version="1.0"?>
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:setfile ="java:com.output.extensionFile">

<xsl:param name="outDir" select="setfile:getCurrentDir(setfile:new())"/>
 
    </xsl:stylesheet>

Below is the the code where we are calling the transformer for conversion from XML to HTML.

{
        javax.xml.transform.TransformerFactory tFactory = new EnterpriseTransformerFactory();
        XslImportResolver myResolve = new XslImportResolver();
        tFactory.setURIResolver( myResolve );
        javax.xml.transform.Transformer transformer = tFactory.newTransformer
                        (new javax.xml.transform.stream.StreamSource(xslLocation));
        Registry registry = Registry.getRegistry( this );
        transformer.transform( new StreamSource( xmlLocation ),
                new StreamResult( new FileOutputStream( htmlLocation ) ) );
 }

Java code for imported Java class

public class extensionFile {
  
  // Empty Constructor
public extensionFile()
{
}

   public Object getCurrentDir()
    {
        return ReportStatic.getCurrentDir();
    }

}

We are getting below error :

Static error at char 22 near {...e:getCurrentDir(setfile:new...} in expression in xsl:param/@select on line 78 column 73 : XPST0017: Cannot find a matching 0-argument function named Q{java:com.output.extensionFile}new(). For diagnostics on calls to Java methods, use the -TJ command line option or set the Configuration property FeatureKeys.TRACE_EXTERNAL_FUNCTIONS

Upvotes: 0

Views: 219

Answers (1)

Michael Kay
Michael Kay

Reputation: 163595

Did you run the suggested diagnostics?

From the information given, the most likely explanations are (a) that the full name of the class is not what you are suggesting, or (b) that the class is not on the classpath. The -TJ diagnostics should reveal the explanation.

Upvotes: 0

Related Questions