A lot has been written about Nokogiri in terms of reading XML using
XPath. However, what's about using Nokogiri with XML containing XPath
references.

In the example, the xml contains a XPath reference:

<element1>
 <element2>
  <location>
   <longitude>...
   <latitude>...
  </location>
 </element2>
 <element3>
  <location reference=""/>
 </element3>
</element1>

Since both location elements are equal, only the first element is
described in detail. The second just references the first.

Using Nokogiri, xml.xpath('//location') returns two node instances as
expected. The first node contains all child nodes. The second only a
reference as an attribute of the second node instance.

Ok, assuming I want to request all longitude values, I would do
xml.xpath('//location/longitude'). This returns only one node instance.
However, since there are actually two elements of type "longitude", I
expected to receive two node instances, expecting Nokogiri to resolve
XPath references...

How do I achieve this with Nokogiri?

-- 
Posted via http://www.ruby-forum.com/.