# File test/xpath_test.rb, line 129 def test_predicates #each_test( @@doc, nil, 1 ) #each_test( @@doc.root, nil, 4 ) assert_equal "12", XPath::first(@@doc, "a/e/f[3]").attributes["id"] assert_equal "13", XPath::first(@@doc, "a/e/f[3]/g").attributes["id"] assert_equal "14", XPath::first(@@doc, "a/e/f[@a='d'][2]").attributes["id"] assert_equal "14", XPath::first(@@doc, "a/e/f[@a='d'][@id='14']").attributes["id"] assert_equal "a", XPath::first( @@doc, "*[name()='a' and @id='1']" ).name each_test( @@doc, "//*[name()='f' and @a='d']", 2) { |i| assert_equal "f", i.name } each_test( @@doc, "//*[name()='m' or @a='d']", 3) { |i| assert ["m","f"].include?(i.name) } assert_equal "b", XPath::first( @@doc, "//b[@x]" ).name end