Hi,
  After much investigation I have confirmed that the classLoader being used in the call is able to see my method, yet when I call it from within the xslt it can not find the method, can you please confirm the following syntax is what you would expect to work?
 
        <xsl:variable name="provider">
                <xsl:value-of select="models:ModelUtils.getString()" xmlns:models="java:com.bt.psalm.utils.model"/>
        </xsl:variable>
 
I am trying to call the class com.bt.psalm.utils.model.ModelUtils and the method getString.
 
I have explicit set the classLoader before instantiation the Transformer Factory and if I use the following code it finds the method:
 

Thread.currentThread().getContextClassLoader().loadClass("com.bt.psalm.utils.model.ModelUtils").getMethod("getString");

I have called the TransformerFactory using:     TransformerFactory tfactory = TransformerFactory.newInstance("net.sf.saxon.TransformerFactoryImpl",getClass().getClassLoader());

Yet I still get:

Error at xsl:value-of on line 58 of bundleentry://117/xsl/xsd2example.xsl:
  XPST0017: XPath syntax error at char 29 on line 58 in {models:ModelUtils.getString()}:
    Cannot find a matching 0-argument function named
  {java:com.bt.psalm.utils.model}ModelUtils.getString()

 

Can you please help?

 

Martin

 



From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Michael Kay
Sent: 20 May 2008 11:43
To: 'Mailing list for the SAXON XSLT and XQuery processor'
Subject: Re: [saxon] How does Saxon gain access to external functions

You need to ensure that the class containing the Java method is on the classpath (that's all)
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of martin.me.roberts@bt.com
Sent: 20 May 2008 11:28
To: saxon-help@lists.sourceforge.net
Subject: [saxon] How does Saxon gain access to external functions

Hi,
  I am running Saxon within an OSGI environment and I need to get it to call static java methods that are defined within the rest of the OSGI environment.  How do I get Saxon to know about these methods?  Is Saxon simply using the classpath available to discover any methods mentioned in the xslt sheet or do I have to explicitly define the 'connection'?
 
Martin