开发者

Problem while accessing Java method through XSLT-1.0

开发者 https://www.devze.com 2023-02-14 12:50 出处:网络
Problems while accessing Java m开发者_Python百科ethod through XSL .\'I have a java class DirectoryReader.java with a static method totalPhotos which returns a int. In my XSL I have defined a namespace

Problems while accessing Java m开发者_Python百科ethod through XSL .'I have a java class DirectoryReader.java with a static method totalPhotos which returns a int. In my XSL I have defined a namespace: xmlns:dirReader="xalan://com.mngi.eidos.util.DirectoryReader and I am trying to access the totalPhotos method like:

<xsl:variable name="totalPhotos" select="dirReader:totalPhotos($PhotoPath)"/>

Can someone please tell me what is wrong in my approach ?

I still get the following error

ERROR: 'The first argument to the non-static Java function 'totalPhotos' is not a valid object reference


Either the method totalPhotos must be static, or you must first create an instance of the class and pass that as the first argument to the call.

<xsl:variable name="dr" select="dirReader:new(....)"/>
<xsl:variable name="totalPhotos" select="dirReader:totalPhotos($dr,$PhotoPath)"/>

Adjust dirReader constructor arguments to your situation

0

精彩评论

暂无评论...
验证码 换一张
取 消