From: Phrogz Date: 2007-03-23T01:55:07+09:00 Subject: Re: Pulling text from elements with REXML On Mar 22, 10:44 am, Paul Willis wrote: > One more thing, given an XML document... > > hello world > > What would be the path to the attribute 'stuff' and return > 'some-other-text'? require 'rexml/document' include REXML doc = Document.new( < hello world hello world ENDDOC att = XPath.first( doc, '//kid/@stuff' ) p att, att.class, att.value #=> stuff='some-other-text' #=> REXML::Attribute #=> "some-other-text" p XPath.first( doc, '//kid[@class="best"]/@stuff' ).value #=> "gibbles" I don't know what the XPath syntax is to select the value of an attribute directly. I'd be interested to know if someone else knows it.