From: matt@... (matt neuburg) Date: 2009-03-18T03:47:33+09:00 Subject: Re: XML to CSV with REXML - I'm sure this should be easy... Sandy Thomson wrote: > ..but, whilst it works for one event with multiple dates, as soon as I > add a second event it iterates through all of the dates against every > event, so for 2 events each with 2 dates it outputs 8 lines... Cool! :) > xml.elements.each("//event") do |e| > e.elements.each("//performance") do |p| Yeah, sorry about that. I wasn't thinking about the XPath here. Obviously "//performance" is wrong. I shoulda said "descendant::performance" or "performances/performance" or similar. Of course one could also argue that Ruby and REXML are more heavyweight than you need; you're just dumpster-diving in simple XML and outputting text, so you could write this whole thing as an XSLT template. Choices, choices...! m. -- matt neuburg, phd = matt@tidbits.com, http://www.tidbits.com/matt/ Leopard - http://www.takecontrolbooks.com/leopard-customizing.html AppleScript - http://www.amazon.com/gp/product/0596102119 Read TidBITS! It's free and smart. http://www.tidbits.com