0

Problems while accessing Java method 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

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.