Re: [xsl] EXSLT user-defined function question

Subject: Re: [xsl] EXSLT user-defined function question
From: Geert Josten <Geert.Josten@xxxxxxxxxxx>
Date: Thu, 11 Nov 2004 22:49:52 +0100
Hi Sanjeeb,

I haven't added functions myself, but the most obvious question is: have you given you java class the proper package name and have you added it to the CLASSPATH of the jvm instance?

Grtz,
Geert

Hi all,

I'm trying to call an user-defined exslt function, and strangely I get
this error. Can somebody quickly suggest something?

Thanks in advance,
-Sanjeeb


Error: } java.lang.RuntimeException: java.lang.NoSuchMethodException: For extension function, could not find method org.apache.xalan.lib.ExsltStrings.replace([ExpressionContext,] #STRING, #STRING, #STRING).

Checked both static and instance methods.



My xsl:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:date="http://exslt.org/dates-and-times";
xmlns:ns="..." xmlns:str="http://exslt.org/strings";
xmlns:func="http://exslt.org/functions";
xmlns:xalan="http://xml.apache.org/xslt";
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
extension-element-prefixes="func date str"
str:doc="http://www.exslt.org/str"; version="1.0">
    <!--$Revision: #2 $-->
    <xsl:import href="import-file.xsl"/>
    <xsl:output indent="yes" xalan:indent-amount="4"/>
    <xsl:template match="/">
...

    <result-tag>	
		<xsl:value-of select="str:replace('ns:field','\r\n','
')"/>
    </result-tag>


Import-file.xsl:


<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:str="http://exslt.org/strings";
                xmlns:func="http://exslt.org/functions";
                xmlns:exsl="http://exslt.org/common";
                extension-element-prefixes="str exsl func">

<func:function name="str:replace">
   <xsl:param name="string" select="''" />
   <xsl:param name="search" select="/.." />
   <xsl:param name="replace" select="/.." />
   <xsl:choose>
      <xsl:when test="not($string)">
        <func:result select="/.." />
      </xsl:when>
      <xsl:when test="function-available('exsl:node-set')">
...

Current Thread