Writing extensions in Java
Added by Anonymous over 16 years ago
Legacy ID: #4936530 Legacy Poster: Michael Hare (mphare)
I tried a dirt simple example. 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: <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:SystemID: D:\mphare\Development\XMLTesting\extensions\test.xsl 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}test() URL: http://www.w3.org/TR/xpath20/#ERRXPST0003 I believe Michael Kay has pointed me in the right direction (and to this forum :)) by suggesting the CLASSPATH is ignored because I just a command line like: java -jar C:\Programs\saxon\saxon8.jar to get execute the processor. Problem is, I'm not sure how to fix it. Thanks, - m ------------------------ GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF ACE5 CA93 7AD5 D8E3 A876 Michael Hare
Replies (3)
Please register to reply
RE: Writing extensions in Java
-
Added by Anonymous over 16 years ago
Legacy ID: #4936744 Legacy Poster: Michael Kay (mhkay)
All is explained at http://www.saxonica.com/documentation/using-xsl/commandline.html Michael Kay Saxonica
RE: Writing extensions in Java
-
Added by Anonymous over 16 years ago
Legacy ID: #4936951 Legacy Poster: Michael Hare (mphare)
Thanks Michael, I'm getting a DNS Error on saxonica this morning, I'll try again a littler later, maybe a router is down somewhere.
RE: Writing extensions in Java
-
Added by Anonymous over 16 years ago
Legacy ID: #4937586 Legacy Poster: Michael Hare (mphare)
So far so good. The extension is working and doing what I expected it to do.. which is not much, but it's doing it. Thanks! - m
Please register to reply