Cannot access updated Java object from Saxon XSLT processor

Posted by chipk on Stack Overflow See other posts from Stack Overflow or by chipk
Published on 2010-04-13T16:29:05Z Indexed on 2010/04/13 17:03 UTC
Read the original article Hit count: 671

Filed under:
|
|

I am working with an open source version of the Saxon XSLT processor "Saxon 9.0.0.2J from Saxonica" and am trying to make use of the java extensibility for the first time. I am running into an issue I suspect may be a limitation on the open source version, but wanted to check first whether there might be something I am just missing here.

From the snippet below, my result is that the final value of $c1 does not change as a result of the call to greg:setTime() - i.e. the $c1 variable within Saxon appears to be unhooked from the underlying Java object and there is no apparent way to access the object as updated by the setTime() call.

NOTE that all code in the snippet is tested and working otherwise - i.e. $c1 is properly instantiated by the getInstance() call, $startdate is of the proper format and $d1 is properly instantiated.

Thoughts?

<xsl:transform
       .....
       xmlns:sql="java:java.sql.Date"
       xmlns:greg="java:java.util.GregorianCalendar"
       .....
>
....
<xsl:element name="JobExpireDate">
      <xsl:variable name="c1" select="greg:getInstance()" />
      <xsl:variable name="d1" select="sql:valueOf($startdate)" />
      <xsl:variable name="void" select="greg:setTime($c1,$d1)" />
      <xsl:value-of select="$c1" />
</xsl:element>

© Stack Overflow or respective owner

Related posts about saxon

Related posts about xslt