Java/XSLT: Cannot find a matching 1-argument function
Asked Answered
A

2

7

I get the following error:

javax.servlet.ServletException: Cannot find a matching 1-argument function named {http://exslt.org/dynamic}evaluate()
at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)

The top of my xslt file is

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    version="1.0"   
    xmlns:dyn="http://exslt.org/dynamic" 
    extension-element-prefixes="dyn"> 

Do you know why I may be getting this error?

UPDATE

The top of my XML file now reads.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet 
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
     version="1.0"
     xmlns:xalan="http://xml.apache.org/xalan" 
     exclude-result-prefixes="xalan">

and the XML where we are failing is

<xsl:template name="test">
  <xsl:param name="param" />
  <xsl:value-of select="$param"/>
  <xsl:value-of select="xalan:evaluate($param)"/>
</xsl:template>

This codes works on one server running Tomcat 5.0 but is not working on a server running Tomcat 5.5. I imagine because the code is working on one server and not it is an environmental problem.

The XSLT is being applied to the XML via a JSP page. To me it looks like the xalan.jar file is not being used. The top of the JSP is:

<%@page import="javax.xml.transform.*"%>
<%@page import="javax.xml.transform.stream.*"%>
<%@page import="         java.security.Principal,
             java.net.URL, 
             java.net.URLConnection, 
             java.io.InputStream,
             java.io.InputStreamReader,
             java.io.Reader,
             java.io.BufferedReader,
             java.io.File,
             javax.xml.transform.*,
             javax.xml.transform.stream.*,
             javax.xml.transform.*,
             javax.xml.transform.stream.*"%>

Update The problem is that Saxon is being chosen as the XML parser. Saxon does not support this functionality. Removing the Saxon.jar fixes the problem.

Artificer answered 16/1, 2009 at 11:42 Comment(0)
Q
1

Somewhere in your XSLT you're referring to a function named "{http://exslt.org/dynamic}evaluate()" and you're not giving it the number of arguments it expects.

Or... it's unable to find the extensions you're adding.

Quickwitted answered 16/1, 2009 at 11:57 Comment(1)
Or... it's unable to find the extensions you're adding. Seems to be the case. Any idea how I would find the extension?Artificer
H
1

Chances are you might be using an older version of Xalan.

Try instead using the xalan:evaluate() extension.

Read more on this in this thread.

Hyland answered 16/1, 2009 at 14:29 Comment(1)
Changed to using xalan:evaluate() but still giving the same error.Artificer

© 2022 - 2024 — McMap. All rights reserved.