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

Re: Problem in calling external java function

Subject: Re: Problem in calling external java function
From: xptm@xxxxxxx
Date: Mon, 20 Sep 2004 12:30:24 +0100
java function declare
First, you're calling getNextToken($test1), with a param, and you have

public String getNextToken() with no params.

Then you'll have to match the data types between $test1 and the param you
declare in the method. I don't know what the data type will be...

But correct the first problem first.

Quoting Manpreet Singh <singhm@xxxxxxxxxxx>:

> Hi,
>    The following is the xslt code calling a java class:
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  xmlns:test="C://tester"
> exclude-result-prefixes="test">
> 	<xsl:template match="/">
> 		<xsl:apply-templates/>
> 	</xsl:template>
> 	<xsl:template match="b">
> 		<xsl:variable name="test1"
> select="test:xyz.new('A;B;C',';')"/>
> 		<abc>
> 			<xsl:value-of select="test:getNextToken($test1)"/>
> 		</abc>
> 	</xsl:template>
> </xsl:stylesheet>
>
>
> The following is the code for the class being called:
>
> import java.util.StringTokenizer;
>
> public class xyz {
>
>   private StringTokenizer tokenizer;
>
>   public CreateMultipleTargetInstance( String specimen, String token ) {
>     tokenizer = new StringTokenizer ( specimen, token );
>   }
>
>   public String getNextToken() {
>     if ( tokenizer.hasMoreTokens() ) {
>       return tokenizer.nextToken();
>     }
>     else {
>       return "";
>     }
>   }
> }
>
> When i call this class using the above xslt Through command prompt using
the
> following command:
>
> java org.apache.xalan.xslt.Process -in test.xml -xsl test.xsl -out out.xml
>
> i get the following error:
>
> file:/C:abc.xsl;
>  Line #9; Column #-1; XSLT Error
(javax.xml.transform.TransformerException):
> java.lang.NoSuchMethodException: For extension function, could not find
> constructor
>  tester.CreateMultipleTargetInstance([ExpressionContext,] #STRING,
#STRING).
>
>
> The xslt is supposed to return me the first string before ";" i.e A.
>
> ...........ANYONE?
>
> Regards
> Manpreet
>
>







O SAPO ja esta livre de vmrus com a Panda Software, fique vocj tambim!
Clique em: http://antivirus.sapo.pt

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.