Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 29th, 2008, 03:16 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 109
Thanks: 18
Thanked 0 Times in 0 Posts
Default Jumping into java extensions to Saxon

So, now I understand I don't need to re-compile Saxon source just to add in extensions.

SO I tried a dirt simple example.


Code:
package com.fujitsu.fnc.swda.extensions;

public class functions {

    /**
     * constructor
     */
    private functions () {

    }

    /**
     * test function
     * @return
     */
    public static int test() {
        return 35;
    }
    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        System.out.println(test());
    }

}
I copied the resulting .class file to my CLASSPATH
and I used this to call it:

Code:
<xsl:text>#x0A;</xsl:text>
        <xsl:text>Testing Processor Extensions</xsl:text>
        <xsl:text>#x0A;</xsl:text>
        <xsl:value-of select="swda:test()" xmlns:swda="java:com.fujitsu.fnc.swda.extensions.functions">
     </xsl:value-of>


Only I get a
Quote:
quote:SystemID: D:\mphare\Development\XMLTesting\extensions\test.x sl
Location: 20:0
Description: XPath syntax error at char 11 on line 20 in {swda:test()}:
    Cannot find a matching 0-argument function named {java:com.fujitsu.fnc.swda.extensions.functions}te st()
URL: http://www.w3.org/TR/xpath20/#ERRXPST0003
message instead of a nice '35' output.

I know I've missed something very fundamental, can anyone help me see the light?

Thanks,

- m


------------------------
GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF ACE5 CA93 7AD5 D8E3 A876

Michael Hare
__________________
------------------------
Keep Moving Forward

GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF ACE5 CA93 7AD5 D8E3 A876

Michael Hare
 
Old April 29th, 2008, 09:03 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Saxon-specific questions are really best raised on the saxon-help list or forum at Sourceforge.

There are a number of things you might have done wrong, for example a very common blunder is to use the -jar option on the command line which causes the classpath to be ignored.

Using Saxon's -TJ option can give useful diagnostics.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old April 29th, 2008, 10:02 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 109
Thanks: 18
Thanked 0 Times in 0 Posts
Default

Sorry, this is the second time you've reminded me about the saxon-help list at SourceForge.
I'll move my further questions over there.

Thanks!

------------------------
GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF ACE5 CA93 7AD5 D8E3 A876

Michael Hare





Similar Threads
Thread Thread Starter Forum Replies Last Post
Memory Error:using saxon with option java -Xmx1024 manish_jaiswal XSLT 4 January 29th, 2008 12:08 PM
entity handling with java extensions stolte XSLT 2 January 23rd, 2008 05:31 AM
XSLT not executing java function(using SAXON) dved XSLT 2 January 15th, 2008 08:46 PM
Saxon java question amhicraig XSLT 1 December 7th, 2007 01:21 PM
calling saxon from java program Tomi XSLT 1 July 31st, 2006 06:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.