Saxon 8 to 9 migration issue

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Saxon 8 to 9 migration issue

mrassinger@e2e.ch
We have to migrate from Saxon 8 to Saxon 9 B. In the XSLT code we use Java HashMap classes for caching purposes.
In Saxon 8 we could put an XSLT node into the hash list and retrieve its value afterwards. However, if try this on Sasxon 9 B I get as result: net.sf.saxon.tinytree.TinyElementImpl@1ae04000

Below you find a small test program to reproduce this effect (Note: the same mechanism works for simple types):


<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
               xmlns:xs="http://www.w3.org/2001/XMLSchema"
               xmlns:cache='java:java.util.HashMap'>

               <xsl:variable name="CACHE" select="cache:new()"/>
               
               <xsl:template match="/">
                              
                              <xsl:variable name="type" as="node()"><x y="a"/></xsl:variable>
                              <xsl:variable name="id" as="xs:string">testid</xsl:variable>
                              
                              <xsl:variable name="put" select="cache:put($CACHE, $id, $type)"/>
                              <xsl:message>put=<xsl:sequence select="$put"/></xsl:message>
                              <xsl:variable name="get" select="cache:get($CACHE, $id)"/>
                              <xsl:message>get=<xsl:sequence select="$get"/> (id=<xsl:value-of select="$id"/>)</xsl:message> 

                              <xsl:message>Clearing CACHE <xsl:value-of select="cache:clear($CACHE)"/></xsl:message>
               </xsl:template>

               <!—Result: 
                              put=
                              get=net.sf.saxon.tinytree.TinyElementImpl@1ae04000 (id=testid)
                              Clearing CACHE 
               -->
</xsl:transform>