Hi all, The bug http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2468 is regarding an improperly initialized iterator under special circumstances: when the iterator is for an xpath constructed in the select of a parameter for a template call, and the call is enclosed by a for-each (whew!). I observed in the bug report that calling cloneIterator() after setStartNode(int) and before next() gets called would reset the iterator properly. Enclosed is a patch to xsltc which emits the necessary instructions to perform this call. (Forgive me for my lack of knowledge of the compiler - I'm sure this is not a perfect fix). Being a relative newbie I hope I'm following the right track on submitting bugs and patches. I'm also interested to hear back from anyone about the patches I've submitted! cheers, john The diff is: --- Expression.java 2001/06/17 12:23:28 1.4 +++ Expression.java 2001/07/06 23:18:32 @@ -159,18 +159,17 @@ return; // nothing to do } - if (this instanceof VariableRef) { - // The method cloneIterator() also does resetting - final int clone = - cpg.addInterfaceMethodref(NODE_ITERATOR, - "cloneIterator", - "()" + NODE_ITERATOR_SIG); - il.append(new INVOKEINTERFACE(clone, 1)); - } - else { + if (this instanceof VariableRef == false) { il.append(methodGen.loadContextNode()); il.append(methodGen.setStartNode()); - } + } + + // always call cloneIterator to initialize iterator + final int clone = + cpg.addInterfaceMethodref(NODE_ITERATOR, + "cloneIterator", + "()" + NODE_ITERATOR_SIG); + il.append(new INVOKEINTERFACE(clone, 1)); } /**
