RE: [xsl] EXSLT user-defined function question

Subject: RE: [xsl] EXSLT user-defined function question
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 28 Nov 2004 23:22:01 -0000
Are you sure than Xalan supports func:function?

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Sanjeeb Basak [mailto:sbasak@xxxxxxxxx] 
> Sent: 28 November 2004 22:46
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] EXSLT user-defined function question
> 
> Hi Geert,
> 
> I'm actually trying to implement the exslt function by xslt, 
> and not by
> java code. I'm wondering if I'm doing some small mistake in the syntax
> of the xslt function implementation, calling of it from the main xslt
> code, the relevant  namespaces, etc.. i'm also trying the 
> exslt function
> the first time :-) 
> 
> Thanks
> Sanjeeb  
> 
> -----Original Message-----
> From: Geert Josten [mailto:Geert.Josten@xxxxxxxxxxx] 
> Sent: Thursday, November 11, 2004 1:50 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] EXSLT user-defined function question
> 
> 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