You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@apache.org on 2001/01/24 15:43:09 UTC
cvs commit: xml-xalan/java/src/org/apache/xpath/axes FilterExprWalker.java LocPathIterator.java
sboag 01/01/24 06:43:09
Modified: java/src/org/apache/xpath/axes FilterExprWalker.java
LocPathIterator.java
Log:
In the FilterExprWalker, don't set the variable stack position if
the walker is not owned by a top-level node iterator. This solves
a bug when running Norm Walsh's docbook stylesheets.
Revision Changes Path
1.14 +19 -13 xml-xalan/java/src/org/apache/xpath/axes/FilterExprWalker.java
Index: FilterExprWalker.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/FilterExprWalker.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- FilterExprWalker.java 2001/01/02 03:47:15 1.13
+++ FilterExprWalker.java 2001/01/24 14:43:06 1.14
@@ -144,19 +144,25 @@
// so we have to set up the variable context, execute the expression,
// and then restore the variable context.
- // System.out.println("calling m_expr.execute(m_lpi.getXPathContext())");
- VariableStack vars = m_lpi.m_execContext.getVarStack();
-
- // These three statements need to be combined into one operation.
- int savedStart = vars.getSearchStart();
- vars.setSearchStart(m_lpi.m_varStackPos);
- vars.pushContextPosition(m_lpi.m_varStackContext);
-
- XObject obj = m_expr.execute(m_lpi.getXPathContext());
-
- // These two statements need to be combined into one operation.
- vars.setSearchStart(savedStart);
- vars.popContextPosition();
+ XObject obj;
+ if(m_lpi.getIsTopLevel())
+ {
+ // System.out.println("calling m_expr.execute(m_lpi.getXPathContext())");
+ VariableStack vars = m_lpi.m_execContext.getVarStack();
+
+ // These three statements need to be combined into one operation.
+ int savedStart = vars.getSearchStart();
+ vars.setSearchStart(m_lpi.m_varStackPos);
+ vars.pushContextPosition(m_lpi.m_varStackContext);
+
+ obj = m_expr.execute(m_lpi.getXPathContext());
+
+ // These two statements need to be combined into one operation.
+ vars.setSearchStart(savedStart);
+ vars.popContextPosition();
+ }
+ else
+ obj = m_expr.execute(m_lpi.getXPathContext());
// System.out.println("Back from m_expr.execute(m_lpi.getXPathContext()): "+obj);
m_nodeSet = (null != obj) ? obj.nodeset() : null;
1.24 +13 -0 xml-xalan/java/src/org/apache/xpath/axes/LocPathIterator.java
Index: LocPathIterator.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/LocPathIterator.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- LocPathIterator.java 2001/01/02 03:47:15 1.23
+++ LocPathIterator.java 2001/01/24 14:43:07 1.24
@@ -246,6 +246,19 @@
}
/**
+ * <meta name="usage" content="advanced"/>
+ * Get if this is an iterator at the upper level of
+ * the XPath.
+ *
+ * @return true if this location path is at the top level of the
+ * expression.
+ */
+ public boolean getIsTopLevel()
+ {
+ return m_isTopLevel;
+ }
+
+ /**
* Initialize the context values for this expression
* after it is cloned.
*