Hi James, On Tue, Aug 16, 2022 at 11:20 PM James Allen <jamesalle...@gmail.com> wrote:
> I tried to remove xalan jar from classpath and use the basic internal jdk > version with java 8 or java 11 but found our use of an internal > java.util.Hashtable to store and retrieve values stopped working Example > (xmlns:myhash="xalan://java.util.Hashtable"). > xsl:variable MYHASH to declare one with myhash:new() > then myhash:put and myhash:get etc caused no errors but value put in could > not be retrieved later with get. As per your use case, as mentioned above, let's consider following XSLT 1.0 example (that's run with XalanJ), XML instance document: <vals> <a>one</a> <b>two</b> <c>three</c> </vals> XSLT stylesheet: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:variable name="myHash" select="java:java.util.Hashtable.new()"/> <xsl:for-each select="vals/*"> <variable name="temp" select="java:put($myHash, name(self::*), string())"/> <xsl:value-of select="java:get($myHash, name(self::*))"/><xsl:text>
</xsl:text> </xsl:for-each> </xsl:template> </xsl:stylesheet> The above XSLT transformation, produces only whitespace output. But I guess, you're expecting an output like following, one two three This can never happen, since XSLT variables are immutable (and, we're trying to modify the hasbtable instance [stored within an XSLT variable] with the method call java:put($myHash, name(self::*), string())). IMHO, XalanJ's implementation is correct, for this use case. -- Regards, Mukul Gandhi --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@xalan.apache.org For additional commands, e-mail: dev-h...@xalan.apache.org