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=17818>.
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=17818

Infinite loop when using xsl:key on an external document

           Summary: Infinite loop when using xsl:key on an external document
           Product: XalanJ2
           Version: 2.5Dx
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: org.apache.xalan.xsltc
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


When using the following key on an external document :
<xsl:key name="extKeys" match="page//*" use="@id"/>

<xsl:for-each select="document('tstext.xml')">
  <xsl:value-of select="key('extKeys', 'id1')/@value"/>
</xsl:for-each>

The translet blocks in an infinite loop.

The bug comes from the fact that the AncestorIterator relies on a
0 value from getParent() to detect it has reached the ROOT. But
using an external document, the DOMImpl is wrapped in a MultiDOM,
that will never return 0 :

    public int getParent(final int node) {
        return _adapters[node>>>24].getParent(node & CLR) | node&SET;
    }

MultiDOM.getParent() should test for ROOT :

    public int getParent(final int node) {
        final int parent = _adapters[node>>>24].getParent(node & CLR);
        return (parent==DOM.ROOT)?DOM.ROOT:(parent | node&SET);
    }

Reply via email to