1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

rexml: Fix a XPath bug of name(node-set)

[Bug #14600]
    
* lib/rexml/functions.rb: Fix a bug that "name(node-set)" returns
  element instead of element name.
  
* test/rexml/test_jaxen.rb: Enable more tests.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kou 2018-04-03 15:51:08 +00:00
parent a03e6e5e28
commit c592ce4023
2 changed files with 31 additions and 19 deletions

View file

@ -86,10 +86,14 @@ module REXML
# Helper method.
def Functions::get_namespace( node_set = nil )
if node_set == nil
yield @@context[:node] if defined? @@context[:node].namespace
yield @@context[:node] if @@context[:node].respond_to?(:namespace)
else
if node_set.respond_to? :each
node_set.each { |node| yield node if defined? node.namespace }
result = []
node_set.each do |node|
result << yield(node) if node.respond_to?(:namespace)
end
result
elsif node_set.respond_to? :namespace
yield node_set
end