sboag 01/08/04 11:23:30
Modified: java/src/org/apache/xalan/transformer TransformerImpl.java
java/src/org/apache/xpath NodeSet.java NodeSetDTM.java
Log:
Bug fixed regarding the current() function in the root template
(related to bug#1269). Bug was reported by David Marston
offline. The test for this is conf/copy/copy29.
In TransformerImpl#applyTemplateToNode, create a NodeSetDTM and pass it to
m_xcontext.pushContextNodeList(cnl);.
In NodeSetDTM fix getCurrentNode so that it doesn't use m_next-1
(which simply appears to be completely wrong). Do the same for
NodeSet... though I don't think this will be called anywhere in
Xalan.
Revision Changes Path
1.111 +5 -0
xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java
Index: TransformerImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -r1.110 -r1.111
--- TransformerImpl.java 2001/08/03 02:43:17 1.110
+++ TransformerImpl.java 2001/08/04 18:23:30 1.111
@@ -1932,6 +1932,10 @@
pushElemTemplateElement(template);
m_xcontext.pushCurrentNode(child);
pushPairCurrentMatched(template, child);
+
+ // Fix copy copy29 test.
+ DTMIterator cnl = new org.apache.xpath.NodeSetDTM(child,
m_xcontext.getDTMManager());
+ m_xcontext.pushContextNodeList(cnl);
if (isDefaultTextRule)
{
@@ -1977,6 +1981,7 @@
{
m_xcontext.getVarStack().unlink();
m_xcontext.popCurrentNode();
+ m_xcontext.popContextNodeList();
popCurrentMatched();
popElemTemplateElement();
}
1.14 +1 -1 xml-xalan/java/src/org/apache/xpath/NodeSet.java
Index: NodeSet.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/NodeSet.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- NodeSet.java 2001/07/28 00:26:00 1.13
+++ NodeSet.java 2001/08/04 18:23:30 1.14
@@ -805,7 +805,7 @@
"This NodeSet can not do indexing or counting functions!");
int saved = m_next;
- Node n = elementAt(m_next-1);
+ Node n = (m_next < m_firstFree) ? elementAt(m_next) : null;
m_next = saved; // HACK: I think this is a bit of a hack. -sb
return n;
}
1.5 +1 -1 xml-xalan/java/src/org/apache/xpath/NodeSetDTM.java
Index: NodeSetDTM.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/NodeSetDTM.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NodeSetDTM.java 2001/08/03 02:43:17 1.4
+++ NodeSetDTM.java 2001/08/04 18:23:30 1.5
@@ -1184,7 +1184,7 @@
"This NodeSetDTM can not do indexing or counting functions!");
int saved = m_next;
- int n = elementAt(m_next-1);
+ int n = (m_next < m_firstFree) ? elementAt(m_next) : DTM.NULL;
m_next = saved; // HACK: I think this is a bit of a hack. -sb
return n;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]