You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by zo...@apache.org on 2003/12/04 17:45:02 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/dom ForwardPositionIterator.java
zongaro 2003/12/04 08:45:02
Modified: java/src/org/apache/xalan/xsltc/dom
ForwardPositionIterator.java
Log:
Added comments to describe the situation in which this iterator is used.
Revision Changes Path
1.7 +27 -1 xml-xalan/java/src/org/apache/xalan/xsltc/dom/ForwardPositionIterator.java
Index: ForwardPositionIterator.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/ForwardPositionIterator.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ForwardPositionIterator.java 1 Apr 2003 21:39:16 -0000 1.6
+++ ForwardPositionIterator.java 4 Dec 2003 16:45:02 -0000 1.7
@@ -71,6 +71,32 @@
* a node in document order. It is needed for the case where
* a call to position() occurs in the context of an XSLT element
* such as xsl:for-each, xsl:apply-templates, etc.
+ *
+ * The getPosition() methods in DTMAxisIterators defined
+ * in DTMDefaultBaseIterators always return the position
+ * in document order, which is backwards for XPath in the
+ * case of the ancestor, ancestor-or-self, previous and
+ * previous-sibling.
+ *
+ * XSLTC implements position() with the
+ * BasisLibrary.positionF() method, and uses the
+ * DTMAxisIterator.isReverse() method to determine
+ * whether the result of getPosition() should be
+ * interpreted as being equal to position().
+ * But when the expression appears in apply-templates of
+ * for-each, the position() function operates in document
+ * order.
+ *
+ * The only effect of the ForwardPositionIterator is to force
+ * the result of isReverse() to false, so that
+ * BasisLibrary.positionF() calculates position() in a way
+ * that's consistent with the context in which the
+ * iterator is being used."
+ *
+ * (Apparently the correction of isReverse() occurs
+ * implicitly, by inheritance. This class also appears
+ * to maintain its own position counter, which seems
+ * redundant.)
*/
public final class ForwardPositionIterator extends DTMAxisIteratorBase {
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org