Xalan Developers:

I found the following bug in xalan 2.4.1D

The key() function throws an exception when called in the context of a 
local variable. Here is an extremely small transform that can be used to 
reproduce the problem. I have verified that this transform works fine in 
2.3.1 but does not work in 2.4.1D. I use the key() function in this manner 
often in my current application.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                        xmlns:xalan="http://xml.apache.org/xalan";
                        extension-element-prefixes="xalan">

<!--
     This style sheet illustrates a bug in xalan 2.4D1 when using the key 
function against
     a computed node set. This example works in 2.3.1

     August 11, 2002
     Nancy Lehrer, Sr. Architect JumpStart Wireless Corporation
     [EMAIL PROTECTED]

Test this style sheet with an input XML doc that looks something like this:
<lookups>
     <item name="a">This is A</item>
     <item name="b">This is B</item>
     <item name="c">This is C</item>
</lookups>

  -->
<xsl:key name="item-lookup" match="item" use="@name" />

<xsl:template match="/lookups" >
     <xsl:variable name="more" >
         <more-items>
             <item name="c">This is more C</item>
             <item name="z">This is more Z</item>
         </more-items>
     </xsl:variable>
     Lookup C:
     <xsl:copy-of select="key('item-lookup', 'c')"/>

     <!-- This section does not work in xalan 2.4D1, but does work in xalan 
2_3_1 -->
     <!-- In 2.4D1 it is not just that they product no results, but an 
exception is thrown -->
     <xsl:for-each select="xalan:nodeset($more)">
     Lookup Z:
            <xsl:copy-of select="key('item-lookup', 'z')" />
     Lookup C again:
            <xsl:copy-of select="key('item-lookup', 'c')" />
     </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

I hope this helps you continue to make Xalan and premier product!

Nancy Lehrer
Sr. Architect - JumpStart Wireless
www.jumpstartwireless.com

PS: I realize that 2.4.1D is a developer's release, and therefore is not 
completely tested. I am however slightly annoyed at how difficult it is to 
find the 2.3.1 release on the website. From my perspective it should be 
extremely obvious how to download the last non-developer release from 
http://xml.apache.org/xalan-j/index.html page. There is no reference to it 
there. I found it from the home apache.org page.


Reply via email to