sboag 01/08/20 16:47:11
Modified: java/src/org/apache/xpath XPathContext.java
Log:
Added getCurrentNodeList() for getting the current node list as defined
by http://www.w3.org/TR/xslt#dt-current-node-list.
This looks up the stack of the SubContextLists to find the top-level
LocPathIterator. I'm fairly unhappy with this fix, and hope to restructure
the context list stuff a bit to avoid the casts in the getCurrentNodeList(),
and to fix getCurrentNode() so that it properly defines the current
node as defined by the XSLT spec. As a matter of fact, I would
like to break up XPathContext into an XSLTContext.
Part of the http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3031
fix.
Revision Changes Path
1.30 +21 -0 xml-xalan/java/src/org/apache/xpath/XPathContext.java
Index: XPathContext.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPathContext.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- XPathContext.java 2001/07/31 22:23:38 1.29
+++ XPathContext.java 2001/08/20 23:47:11 1.30
@@ -990,6 +990,27 @@
return m_axesIteratorStack.isEmpty()
? null : (SubContextList) m_axesIteratorStack.peek();
}
+
+ /**
+ * <meta name="usage" content="internal"/>
+ * Get the <a href="http://www.w3.org/TR/xslt#dt-current-node-list">current node
list</a>
+ * as defined by the XSLT spec.
+ *
+ * @return the <a href="http://www.w3.org/TR/xslt#dt-current-node-list">current
node list</a>.
+ */
+ public org.apache.xpath.axes.LocPathIterator getCurrentNodeList()
+ {
+ for (int i = m_axesIteratorStack.size()-1; i >= 0; i--)
+ {
+ org.apache.xpath.axes.PredicatedNodeTest iter
+ = (org.apache.xpath.axes.PredicatedNodeTest)m_axesIteratorStack.elementAt(i);
+ org.apache.xpath.axes.LocPathIterator lpi = iter.getLocPathIterator();
+ if(lpi.getIsTopLevel())
+ return lpi;
+ }
+ return null;
+ }
+
//==========================================================
// SECTION: Implementation of ExpressionContext interface
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]