RE: [xsl] Saxon and HashMap/Hashtable

Subject: RE: [xsl] Saxon and HashMap/Hashtable
From: William Lam <xeenman@xxxxxxxxx>
Date: Thu, 12 Jul 2001 10:52:24 -0700 (PDT)
I am using version 6.3

Where can I get 6.4.2?  I only see 6.4 on the website.

--- Michael Kay <mhkay@xxxxxxxxxxxx> wrote:
> I can't reproduce this. The output I get from Saxon
> 6.4.2 is
> 
> <?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, there is no guarantee that an XSLT
> processor will evaluate the
> variable $void: it is never referenced and therefore
> a processor is entitled
> to avoid evaluating it. You cannot rely on variables
> being evaluated in any
> particular order, or at all, unless they are
> actually referenced - calling
> external functions that have side-effects is
> therefore fraught with danger.
> See XSLT Prog Ref Chap 8 (2nd edition), esp
> pp587-590, for a discussion of
> this.
> 
> Mike Kay
> 
> 
> > -----Original Message-----
> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On
> Behalf Of William Lam
> > Sent: 11 July 2001 18:55
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: [xsl] 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
> >
> 
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________________________
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


Current Thread