I am defining a varible through the following method so that I keep the dependability of functional programming. Notice how I start by cloning an object and I never modify that object which is assigned to a variable. I don't want side effects:
<xsl:variable name="selected-month">
<xsl:variable name="selected-month" select="java:clone($calendar)"/>
<xsl:if test="java:set($selected-month, $date-field-value, 1)"/>
<xsl:if test="java:add($selected-month, $month-field-value, $month-offset)"/>
<xsl:value-of select="$selected-month"/>
</xsl:variable>


So, while I manipulate the value of the internal variable, it is only used to temporarily define the final outcome. However, <xsl:value-of> is not doing the same thing that <xsl:variable select=""/> would do. My variable is not getting a Java object assigned. When I later try to reference it for example:
<xsl:value-of select="java:get($selected-month, $month-field-value)"/>


I get this error: org.apache.cocoon.ProcessingException: Failed to execute pipeline.: java.lang.RuntimeException: java.lang.NoSuchMethodException: For extension function, could not find method org.apache.xml.dtm.ref.DTMNodeIterator.get([ExpressionContext,] #NUMBER).

Any thoughts?  Thanks,
RRM




Reply via email to