zongaro 2003/02/11 02:39:21 Modified: java/src/org/apache/xml/dtm/ref Tag: xslt20 DTMDefaultBaseIterators.java Log: Propagating fix for Bugzilla bug 9575. The AncestorIterator was incorrectly returning the document root twice. Revision Changes Path No revision No revision 1.15.2.1.2.2 +11 -9 xml-xalan/java/src/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java Index: DTMDefaultBaseIterators.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java,v retrieving revision 1.15.2.1.2.1 retrieving revision 1.15.2.1.2.2 diff -u -r1.15.2.1.2.1 -r1.15.2.1.2.2 --- DTMDefaultBaseIterators.java 30 Jan 2003 00:39:54 -0000 1.15.2.1.2.1 +++ DTMDefaultBaseIterators.java 11 Feb 2003 10:39:21 -0000 1.15.2.1.2.2 @@ -1491,8 +1491,6 @@ else _startNode = getParent(node); - _currentNode = getDocumentRoot(node); - node = _startNode; while (node != END) { @@ -1501,6 +1499,10 @@ } m_ancestorsPos = m_ancestors.size()-1; + _currentNode = (m_ancestorsPos>=0) + ? m_ancestors.elementAt(m_ancestorsPos) + : DTM.NULL; + return resetPosition(); } @@ -1515,11 +1517,12 @@ */ public DTMAxisIterator reset() { - - _currentNode = getDocumentRoot(_startNode); m_ancestorsPos = m_ancestors.size()-1; + _currentNode = (m_ancestorsPos>=0) ? m_ancestors.elementAt(m_ancestorsPos) + : DTM.NULL; + return resetPosition(); } @@ -1533,11 +1536,10 @@ int next = _currentNode; - int pos = m_ancestorsPos--; - if(pos < 0) - _currentNode = DTM.NULL; - else - _currentNode = m_ancestors.elementAt(pos); + int pos = --m_ancestorsPos; + + _currentNode = (pos >= 0) ? m_ancestors.elementAt(m_ancestorsPos) + : DTM.NULL; return returnNode(next); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]