I can't figure out how to do this.

  require 'libxml'

  xml = LibXML::XML::Document.string <<-EOS
    <root><x><m id="a" class="q">dummy</m><n id="b" class="q">dummy</
n></x></root>
  EOS

  nodes = xml.find(".//*...@class='q']")

  nodes.to_a
  => [<m id="a" class="q">dummy</m>, <n id="b" class="q">dummy</n>]

  x = nodes[0]
  => <m id="a" class="q">dummy</m>

So far so good.

  x.find(".//*...@id='a']").to_a
  => []

no match? I expect it to be:

  => [<m id="a" class="q">dummy</m>]

Why isn't it matching against the current context? I can't seem to
find any way to make it do that.

Thanks,
Tom
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to