# \[BUG?\] XPath $B$rMxMQ$7$?%N!\<%IC5:w$,\<:GT$9$k(B

**URL:** <https://www.ruby-forum.com/t/bug-xpath-b-rmxmq-7-n-ic5-w-gt-9-k-b/92430>\
**Category:** Development\
**Created:** [April 19, 2007, 1:23pm UTC](https://www.ruby-forum.com/t/bug-xpath-b-rmxmq-7-n-ic5-w-gt-9-k-b/92430 "2007-04-19T13:23:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hirofumi\_HONDA](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/eb8c5e/32.png) [@Hirofumi\_HONDA](https://www.ruby-forum.com/u/Hirofumi_HONDA)\
**Post date:** [April 19, 2007, 1:23pm UTC](https://www.ruby-forum.com/t/bug-xpath-b-rmxmq-7-n-ic5-w-gt-9-k-b/92430/1 "2007-04-19T13:23:07Z")

</div>

e$B$O$8$a$^$7$F!#e(B  
e$B$[$s$@$H?=$7$^$9!#e(B

REXML e$B$N%P%0$i$7$-$b$N$rH/8+$7$?$N$GJs9p$7$^$9!#e(B

ruby 1.8.6 e$B$G0J2\<$N%3!\<%I$r\<B9T$9$k$H!"e(B  
namespace e$B$,@\_Dj$5$l$F$$$ke(B xml e$B$Ge(B  
e$B%N!\<%IC5:w$,\<:GT$7$^$9!#e(B

* * *

require ‘rexml/document’

puts “RUBY\_VERSION = %s” % RUBY\_VERSION  
puts “REXML::VERSION = %s” % REXML::VERSION  
puts “PLATFORM = %s” % PLATFORM

xhtml = %|

 |

docs = Array.new(2) do REXML::Document.new(xhtml) end  
docs[1].root.delete\_namespace

xpath = %|html/head/link[attribute::rel=“stylesheet”]|  
puts “XPath = %s” % xpath

## docs.each do |doc| elements = doc.get\_elements(xpath) puts “namespace = %s” % doc.root.namespace puts “nodes size = %s” % elements.size end

## e$B!&e(B1.8.6 e$B$N=PNOe(B

## RUBY\_VERSION = 1.8.6 REXML::VERSION = 3.1.6 PLATFORM = i486-linux XPath = html/head/link[attribute::rel=“stylesheet”] namespace = [XHTML namespace](http://www.w3.org/1999/xhtml) nodes size = 0 namespace = nodes size = 2

## e$B!&e(B1.8.5 e$B$N=PNOe(B

RUBY\_VERSION = 1.8.5  
REXML::VERSION = 3.1.4  
PLATFORM = i686-linux  
XPath = html/head/link[attribute::rel=“stylesheet”]  
namespace = [XHTML namespace](http://www.w3.org/1999/xhtml)  
nodes size = 2  
namespace =  
nodes size = 2
