[ http://issues.apache.org/jira/browse/XALANJ-2237?page=all ]
     
Henry Zongaro resolved XALANJ-2237:
-----------------------------------

    Fix Version: 2.7
     Resolution: Duplicate

This is a duplicate of XALANJ-1955, which did indeed identify a bug in the way 
hash code collisions were handled.

This problem was fixed prior to the release of Xalan-J 2.7.0, so you're 
probably not using the version of Xalan-J that you believe you're using.  See 
this FAQ entry [1] for more information.  If that doesn't help you resolve the 
problem, please feel free to reopen this bug report, and we'll investigate 
further what's going wrong.

[1] http://xml.apache.org/xalan-j/faq.html#faq-N100D6

> xsl:key generates one key entry for two different strings
> ---------------------------------------------------------
>
>          Key: XALANJ-2237
>          URL: http://issues.apache.org/jira/browse/XALANJ-2237
>      Project: XalanJ2
>         Type: Bug
>   Components: Xalan
>     Versions: 2.7
>  Environment: (Fedora Core 3) Linux  2.6.10-1.770_FC3smp #1 SMP Thu Feb 24 
> 14:20:06 EST 2005 i686 i686 i386 GNU/Linux
> java version "1.4.2_05"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
> Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)
>     Reporter: Nicholas Sushkin
>     Priority: Critical
>      Fix For: 2.7
>  Attachments: keybug-workaround.xsl, keybug.xml, keybug.xsl
>
> It seems that xsl:key generates one key entry for two different values of the 
> key. Is this some type of hash collision?
> Input file:
> <root>
>   <Transaction num="1">
>     <PC>PRMI03SO</PC>
>   </Transaction>
>   <Transaction num="2">
>     <PC>PRMI03T0</PC>
>   </Transaction>
>   <Transaction num="3">
>     <PC>PRMI03T1</PC>
>   </Transaction>
> </root>
> Stylesheet:
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>   version="1.0">
>   <xsl:output method="xml" encoding="ISO-8859-1"/>
>   <xsl:key name="txn-by-account" match="Transaction" use="PC"/>
>     
>   <xsl:template match = "/">
>     <xsl:apply-templates select="root"/>
>   </xsl:template>
>   <xsl:template match="root">
>     <Accounts>
>       <!-- select the first Transaction for each unique account -->
>       <!-- xsl:apply-templates select="Transaction[ generate-id() = 
> generate-id(key('txn-by-account', PC)[1]) ]"/ -->
>       <xsl:apply-templates select="Transaction"/>
>     </Accounts>
>   </xsl:template>
>   <xsl:template match="Transaction">
>     <Account num="[EMAIL PROTECTED]" pc="{PC}" 
> count="{count(key('txn-by-account', PC))}" gid="{generate-id()}" 
> gid1="{generate-id(key('txn-by-account', PC)[1])}">
>       <PCs>
>         <xsl:for-each select="key('txn-by-account', PC)">
>           <xsl:value-of select="@num"/>
>           <xsl:text>=</xsl:text>
>           <xsl:value-of select="PC"/><xsl:text>, </xsl:text>
>         </xsl:for-each>
>       </PCs>
>     </Account>
>   </xsl:template>
>       
> </xsl:stylesheet>
> Incorrect output:
>  java -server -Xmx384m -Xms32m org.apache.xalan.xslt.Process -edump -diag -IN 
> /tmp/keybug.xml -XSL /tmp/keybug.xsl -XML
> <?xml version="1.0" encoding="ISO-8859-1"?><Accounts><Account gid1="N10004" 
> gid="N10004" count="2" pc="PRMI03SO" num="1"><PCs>1=PRMI03SO, 2=PRMI03T0, 
> </PCs></Account><Account gid1="N10004" gid="N1000B" count="2" pc="PRMI03T0" 
> num="2"><PCs>1=PRMI03SO, 2=PRMI03T0, </PCs></Account><Account gid1="N10012" 
> gid="N10012" count="1" pc="PRMI03T1" num="3"><PCs>3=PRMI03T1, 
> </PCs></Account></Accounts>
>  --------- Transform of /tmp/keybug.xml via /tmp/keybug.xsl took 334 ms
> Since the values of all PC element are different in all three accounts, there 
> should be three different entries in the key. However, as you can see, the 
> key returns only two different entries. The key returns the same nodeset for 
> matches PRMI03SO and PRMI03T0.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to