[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: calling java methods from a stylesheet

Subject: RE: calling java methods from a stylesheet
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 21 Sep 2009 21:48:46 +0100
RE:  calling java methods from a stylesheet
Firstly note that this changes in Saxon 9.2. With 9.2, picking up Java
methods from the classpath ("reflexive extension functions") is not
supported in Saxon-HE: you need Saxon-PE or Saxon-EE.

Other than that: use the -TJ flag on the command line for extra diagnostics.
This will explain where the software is looking for the extension function
which may help to explain why it wasn't found.

Regards,

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

> -----Original Message-----
> From: Garvin Riensche [mailto:g.riensche@xxxxxxx] 
> Sent: 21 September 2009 18:55
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  calling java methods from a stylesheet
> 
> Hi there,
>  
> i have some stylesheets which were written to be processed by 
> the xalan processor. Now I want to switch to saxon. These 
> stylesheets contain java methods that should be executed. 
> Therefore they include the following namespace 
> "xmlns:java="http://xml.apache.org/xslt/java". The .jar file 
> which holds the java classes is included in the classpath. A 
> method call looks like the following:
> 
> <xsl:value-of 
> select="java:de.novum.vger.util.DateUtil.getTodayString()" />
> 
> which works fine with xalan.
> 
> How can I make these stylesheets work with saxon without 
> changing too much?
> 
> I thought it would work like this:
> 
> add namespace: xmlns:java="java:de.novum.vger.util.DateUtil"
> call method:
> <xsl:value-of select="java:getTodayString()" />
> 
> but I get the following error:
> Error at xsl:value-of on line 40 column 84 of 
> stylesheet_leistungsfall_variabel_dta.xsl
>   XPST0017: XPath syntax error at char 21 on line 40 in
> {java:getTodayString()}:
>     Cannot find a matching 0-argument function named
>   {java:de.novum.vger.util.DateUtil}getTodayString()
> 
> Why does saxon not find the class, although the jar-file 
> containing it is in the classpath?
> 
> regards,
> Garvin

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.