On Thu, Nov 24, 2011 at 5:02 PM, Robert Klemme <shortcutter / googlemail.com> wrote: > Generally *-sibling refers to all siblings, i.e. sub nodes of the same node > > irb(main):016:0> doc = Nokogiri.XML("<a><k/><b>1</b><b>2</b></a>") > => #<Nokogiri::XML::Document:0x832daa4 name="document" > children=[#<Nokogiri::XML::Element:0x832d810 name="a" > children=[#<Nokogiri::XML::Element:0x832d68a name="k">, > #<Nokogiri::XML::Element:0x832d568 name="b" > children=[#<Nokogiri::XML::Text:0x832d450 "1">]>, > #<Nokogiri::XML::Element:0x831c02e name="b" > children=[#<Nokogiri::XML::Text:0x831bf02 "2">]>]>]> > > irb(main):017:0> doc.xpath('//k/following-sibling::b').size > => 2 > > irb(main):019:0> puts doc.xpath('//k/following-sibling::b') > <b>1</b> > <b>2</b> > => nil Hi, Now I see what was wrong with my reasoning. I was misunderstanding the XML structure. Somehow, I thought that the only topic at the same level as the key was the one we wanted to search. Looking more closely I realized that key is at the same level as all other topic nodes in the document. Thanks, Jesus.