XSLT on external function with SAXON PE-9.5

Oxygen general issues.
ldibanyez
Posts: 1
Joined: Sat Nov 09, 2013 2:09 am

XSLT on external function with SAXON PE-9.5

Post by ldibanyez »

Hi,

Oxygen 15.3 with student license on MacOS Lion.
I'm experimenting with xslt with external functions, I followed the documentation on reflexive functions and I create a very simple class:

Code: Select all

package prueba;

public class Saludo {

public static String hola(){
return "Hola";
}
}
I packaged it in a .jar, that was verified by using it in another class, and created a simple .xslt to call it:

Code: Select all


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:output indent="yes" method="xml" />

<xsl:template match="data/element">

<elemento>
<prueba>
<xsl:value-of select="saludo:hola()" xmlns:saludo="java:prueba.Saludo" />
</prueba>
</elemento>
</xsl:template>
I created a transformation scenario with Saxon PE 9.5.1.2 as engine and added my jar as an extension, however, the editor gives me the error:

Code: Select all

XPST0017 XPath syntax error at char 0 on line 27 in {saludo:hola()}: Cannot find a matching 0-argument function named {java:prueba.Saludo}hola(). For diagnostics on calls to Java methods, use the -TJ command line option or set the Configuration property FeatureKeys.TRACE_EXTERNAL_FUNCTIONS
When I run the transformation, same error. I tried adding a validation scenario, but still, the same error. Calling standard java functions work. I also verified that extensions are activated in the preferences.

Any hint?

Best Regards,
Luis
adrian
Posts: 2879
Joined: Tue May 17, 2005 4:01 pm

Re: XSLT on external function with SAXON PE-9.5

Post by adrian »

Hi,

I'm guessing you're using Oxygen v15.1 (bundles Saxon-PE 9.5.1.2).
I don't see any problems in the setup you described here. Considering that standard functions work, there may a problem with the way you have configured the extension or the extension itself (.class or .jar).
Make sure the JAR is correctly packed (preserve the package folder hierarchy). In the Extensions configuration add the jar itself (or the compiled classes root folder).

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply