On Oct 16, 2005, at 9:07 AM, Jeff Wood wrote:
> count = 0 ; xml.elements( '/a/d' ).each { count += 1 ) ; puts count

Because the each method returns the collection, you can actually just  
do this (odd-looking) hack:
     puts xml.elements.each('/a/d'){}.size

(The block is required, but may be empty.)