"Ken" <ken.j / hotmail.com> wrote: > If you put a yield statement in your events.each iterator, you'll see what > I mean. It will report the first 203 correctly. The loop will break that > that point because yield will tell you that you have no block. But the > point is when you take out yield, you'll see that your output is all the > 203's. Hmmm. But, you know, you gave me an idea and it does appear to work, at least when I get out of using my event iterator. Check this out. If I use this: XPath.first(xml, '//variable[@name="203G_OrdUpdate"][following-sibling::variable[1][@name="16G_OrdAdd"]]') I do get the 203 that appears just before the 16G_OrdAdd. (There are 30 203's in the file and I can tell it's grabbing the right one because each has a unique count attribute.) Similarly, I can do this: XPath.first(xml, '//variable[@name="203G_OrdUpdate"][preceding-sibling::variable[1][@name="202G_OrdAdd"]]') That, in turn gets me the first 203 after my 202. If I change my "first" to "match" then everything comes up just as I want. So I think my use of the events iterator was throwing me off in terms of getting my results. It looks like I don't really need to do that. Is the iterator what you were referring to in terms of this not being workable? (The "yield" thing kind of threw me off.) - Jeff