Project

Profile

Help

SAXON caching Java function return values

Added by Anonymous almost 16 years ago

Legacy ID: #6356736 Legacy Poster: Seetha Arun (seethaarun)

I have a simple loop <xsl:for-each select="0 to 4"> <xsl:value-of select="my:f(.)"/> </xsl:for-each> my:f() is a simple static Java function defined in an appropriate class and referenced appropriately in the my namespace. The function itself is: public static String f(String in) { return in; } I expect to see 0123 as output of this XSLT. However, I get 0000. I think the function is called only once. What am I doing wrong here?


Replies (1)

RE: SAXON caching Java function return values - Added by Anonymous almost 16 years ago

Legacy ID: #6356812 Legacy Poster: Seetha Arun (seethaarun)

Ok. I figured out what the issue is.... SAXON was not caching the values. I merely was not passing the arguments correctly. In the actual code, I was passing like so: <xsl:value-of select="my:f('abc{.}')"/> which SAXON did not like. I have to pass like so: <xsl:variable name="x">abc<xsl:value-of select="."/></xsl:variable> <xsl:value-of select="my:f('$x')"/>

    (1-1/1)

    Please register to reply