Menu

Cannot find a matching 0-argument function

Help
Arun
2012-02-06
2012-10-08
  • Arun

    Arun - 2012-02-06

    Hi,

    I am trying to invoke an external java function using Xslt and iam getting the
    error:


    Start Transformation (Mon Feb 06 23:46:55 CET 2012)
    Error at xsl:value-of on line 35 column 42 of load_builder_template.xsl:
    XPST0017: XPath syntax error at char 10 on line 35 in {fib:ambi()}:
    Cannot find a matching 0-argument function named
    {java:loadbuildergui.views.XMLParser}ambi()
    Failed to compile stylesheet. 1 error detected.
    --- End Transformation (Mon Feb 06 23:46:55 CET 2012) ---
    -----------------------------------------------------------

    I tried updating to latest saxon EE edition as well, but still getting the
    same error.
    Can any one help me out please?

    Thanks,
    Arun

     
  • Arun

    Arun - 2012-02-06

    My XSLT file is:

    <xsl:stylesheet version="2.0" xmlns:xsl="[http://www.w3.org/1999/XSL/Transform](http://www.w3.org/1999/XSL/T ransform)" xmlns:fib="java:loadbuildergui.views.XMLParser" xmlns:saxon="[http://icl.com/saxon](http://icl.com/saxon)" exclude-result-prefixes="fib saxon">

    <xsl:template match="/">

    <Root>
    <xsl:for-each select="Module/LoadBuilder/Configuration">
    <Config>

    <LoadPartnumber><xsl:value-of select="@loadPN"/></LoadPartnumber>
    <Targets><xsl:value-of select="@targets"/></Targets>
    <DataPartnumber><xsl:value-of select="@dataPN"/></DataPartnumber>
    <DataFileName><xsl:value-of select="@dataFileName"/></DataFileName>
    <SupportPartnumber><xsl:value-of select="@supportPN"/></SupportPartnumber>
    <SupportFileName><xsl:value-of select="@supportFileName"/></SupportFileName>
    <ExportFilePath><xsl:value-of select="@ExportFile"/></ExportFilePath>

    </Config>
    </xsl:for-each>
    </Root>
    </xsl:template>

    <xsl:template match="abb" <br="">xmlns:fib="java:loadbuildergui.views.XMLParser">
    <abb>
    <xsl:value-of select="fib:ambi()"/>
    </abb>
    </xsl:template>

    </xsl:stylesheet>

    I am just trying to invoke a static function called ambi() of class XMLParser.

     
  • Michael Kay

    Michael Kay - 2012-02-07

    There are a number of possible reasons: the two most likely are not having
    Saxon-EE activated, and the class not being on the classpath. If you're
    running from the command line, please (a) set the -t and -TJ options, and (b)
    tell us what your command line looked like, and what the output was. If you're
    running from a Java API, please tell us which API and how you are invoking it.

    Michael Kay
    Saxonica

     
  • Arun

    Arun - 2012-02-07

    Hi Michael,

    I am trying to run this XSLT file from Eclipse editor as XSL Transformation
    and I have the class path updated for the java file which I am trying to
    invoke. But still no joy.

    Thanks,
    Arun

     
  • Michael Kay

    Michael Kay - 2012-02-07

    I would suggest trying to get it running from the command line first. There
    are so many ways of getting things wrong in Eclipse, it's hard to disentangle
    the issues.

     
  • Arun

    Arun - 2012-02-08

    Hi Michael,

    As suggested I tried from command line and I am getting below error. I am
    using EE edition with trial license key.Can't i invoke external functions via
    trial license key?

    C:\saxon>java -cp saxon9ee.jar net.sf.saxon.Transform -TJ
    -s:LoadBuilder_config.
    xml -xsl:load_builder_template.xsl -o:c:\temp_new.xml
    No license file found - running with licensable features disabled
    Looking for function {java:samples.java.XMLParser}ambi
    Trying net.sf.saxon.functions.SystemFunctionLibrary
    Trying net.sf.saxon.style.StylesheetFunctionLibrary
    Trying net.sf.saxon.functions.VendorFunctionLibrary
    Trying net.sf.saxon.functions.ConstructorFunctionLibrary
    Trying net.sf.saxon.query.XQueryFunctionLibrary
    Trying net.sf.saxon.functions.IntegratedFunctionLibrary
    Trying com.saxonica.config.JavaExtensionLibrary
    Looking for method ambi in namespace java:samples.java.XMLParser
    Number of actual arguments = 0
    Calls to extension functions are not permitted without a Saxon license
    Trying net.sf.saxon.style.StylesheetFunctionLibrary
    Function {java:samples.java.XMLParser}ambi not found!
    Loading samples.java.XMLParser
    The class samples.java.XMLParser could not be loaded: samples.java.XMLParser
    Error at xsl:value-of on line 35 column 42 of load_builder_template.xsl:
    XPST0017 XPath syntax error at char 0 on line 35 in {fib:ambi()}:
    Cannot find a matching 0-argument function named {java:samples.java.XMLParse
    r}ambi().
    For diagnostics on calls to Java methods, use the -TJ command line option or s
    et the
    Configuration property FeatureKeys.TRACE_EXTERNAL_FUNCTIONS
    Failed to compile stylesheet. 1 error detected.

     
  • Michael Kay

    Michael Kay - 2012-02-08

    Try extending the classpath to include (a) the directory containing your
    license key, and (b) the directory or JAR file containing your compiled
    extension function.

     
  • Arun

    Arun - 2012-02-08

    I have included both the license key and the jar containing compiled
    extenstion function but still the license key is not getting recognized,
    getting the same error.

    My CLASSPATH is:
    .;C:\Program Files\Java\jre1.6.0_07\lib\ext\QTJava.zip;C:\eclipse\interview\Lo
    adBuilderGUI\classes\loadbuildergui\views\LoadBuilder.jar;C:\saxon\arun.jar;C:
    \saxon\saxon-license.lic;

    Not sure what is going wrong.

     
  • Michael Kay

    Michael Kay - 2012-02-08

    Don't put your license file on the classpath; put the directory containing the
    license key on the classpath.

     
  • Arun

    Arun - 2012-02-08

    Still no joy, getting same error No license file found - running with
    licensable features disabled.

     
  • Michael Kay

    Michael Kay - 2012-02-08

    Check the FAQ on license key problems here:

    http://www.saxonica.com/documentation/about/installationjava/licensefaq.xml

    If the directory containing the license file is on the classpath, it works,
    and if it isn't, then it fails the way you have described, so the cause is
    pretty clear. The slightest spelling mistake in defining your classpath will
    cause the symptoms you are decribing. Just check it again until you find the
    mistake.

     
  • Michael Kay

    Michael Kay - 2012-02-08

    And I noticed you didn't set the -t option as I suggested.

     
  • Arun

    Arun - 2012-02-08

    I got it working now, there was a space in the name of the license key file
    "saxon-license .lic"
    This was the culprit.

    Thank you so much for your help Michael.