# File rexml/xpath_parser.rb, line 529 def Predicate path, nodeset #puts "Predicate '#{path}'" if DEBUG return nil unless path[0] == ?[ predicates = [] while path[0] == ?[ path, expr = get_group path predicates << expr[1..-2] if expr end count = -1 mapping = nodeset.collect{ count = count+1 } nodes = nodeset.clone predicates.each do |expr| subresults = [] nodes.each do |node| #puts "PREDICATE FILTERING #{node.name if node.kind_of? Element}" if DEBUG ind = nodes.index(node)+1 Functions.node = node Functions.pair = [ ind, nodes.size ] Functions.namespace_context = node p, r = OrExpr(expr, [node]) r = r[0] if r.kind_of? Array if r.to_s =~ /^\d+$/ r = r.to_i r = (r == ind) end #puts "PREDICATE ON NODE #{node.name if node.kind_of? Element}" if DEBUG #puts "PREDICATE RESULTS ARE #{r}" if DEBUG subresults << r #puts "RESULT SET IS #{puta subresults}" if DEBUG end join( nodes, subresults ) {|a,o,b| a if b} join( mapping, subresults ) {|a,o,b| a if b} nodes.compact! mapping.compact! end #results = nodeset.collect{ false } results = [] mapping.each{|ind| results[ind] = true} results << false while results.size < nodeset.size #puts "PREDICATE RETURNING #{puta results}" if DEBUG [path, results] end