This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Saxon and HashMap/Hashtable


I use Saxon with this style sheet:

<xsl:stylesheet version="1.0"
 xmlns:Hashtable="whatever/java.util.Hashtable"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
 exclude-result-prefixes="Hashtable String" 
 xmlns:String="whatever/java.lang.String">
    <xsl:output method="xml" indent="yes" />
    <xsl:variable name="hash" select="Hashtable:new()"
/>
    <xsl:variable name="key" select="'key'" />
    <xsl:variable name="void" 
select="Hashtable:put($hash, $key, 'value')" />

    <xsl:template match="/">
         <test>
             <test_1>
                 <xsl:value-of
select="Hashtable:get($hash, String:new('key'))" />
             </test_1>
             <test_2>
                 <xsl:value-of
select="Hashtable:get($hash, $key)" />
             </test_2>
             <hashcode_1>
                 <xsl:value-of
select="String:hashCode($key)" />
             </hashcode_1>
             <hashcode_2>
                 <xsl:value-of
select="String:hashCode(String:new('key'))" />
             </hashcode_2>
             <size>
                 <xsl:value-of
select="Hashtable:size($hash)" />
             </size>
         </test>
     </xsl:template>

</xsl:stylesheet>


===================================================

I want this output:

<?xml version="1.0" encoding="utf-8"?>
<test>
   <test_1>value</test_1>
   <test_2>value</test_2>
   <hashcode_1>106079</hashcode_1>
   <hashcode_2>106079</hashcode_2>
   <size>1</size>
</test>

====================================================

However, I get this output:

<?xml version="1.0" encoding="utf-8"?>
<test>
   <test_1/>
   <test_2>value</test_2>
   <hashcode_1>106079</hashcode_1>
   <hashcode_2>106079</hashcode_2>
   <size>1</size>
</test>

===================================================

test_1 is missing!  I have no problems with this using Xalan.

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]