DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21474>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21474

xsl:key fails to index documents created by stylesheet

           Summary: xsl:key fails to index documents created by stylesheet
           Product: XalanC
           Version: 1.5
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: XalanC
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The following stylesheet will demonstrate the problem:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:xalan="http://xml.apache.org/xalan";>
        
        <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
        
        <xsl:key name="fooKey" match="foo" use="@name"/>
        
        <xsl:variable name="combine">
      <doc>
        <foo name="test1"/>
      </doc>
      <doc>
        <foo name="test2"/>
      </doc>
        </xsl:variable> 
        
        <xsl:template match="/">
            <result>
              <xsl:apply-templates select="xalan:nodeset($combine)/*"/>
            </result>
        </xsl:template>
        
        <xsl:template match="doc">
          <test>
            <xsl:copy-of select="key('fooKey', 'test1')"/>
          </test>
        </xsl:template> 
        
</xsl:stylesheet>

The Java version of Xalan will correctly output:
<?xml version="1.0" encoding="UTF-8"?>
<result xmlns:xalan="http://xml.apache.org/xalan";>
<test>
<foo name="test1"/>
</test>
<test>
<foo name="test1"/>
</test>
</result>

But XalanC will incorrectly output:
<?xml version="1.0" encoding="UTF-8"?>
<result xmlns:xalan="http://xml.apache.org/xalan";>
<test/>
<test/>
</result>

Reply via email to