REXML problem

I'm trying to use a ruby and rexml to manipulate some Qt linguist xml files, but I've run into a problem with certain XPath expressions.

The script below fails with the following error

/usr/lib/ruby/1.8/rexml/xpath_parser.rb:718:in `compare': undefined method `<' for <source> ... </>:REXML::Element (NoMethodError)
         from /usr/lib/ruby/1.8/rexml/xpath_parser.rb:626:in `equality_relational_compare'
         from /usr/lib/ruby/1.8/rexml/xpath_parser.rb:626:in `equality_relational_compare'
         from /usr/lib/ruby/1.8/rexml/xpath_parser.rb:387:in `expr'
         from /usr/lib/ruby/1.8/rexml/xpath_parser.rb:383:in `expr'
         from /usr/lib/ruby/1.8/rexml/xpath_parser.rb:282:in `expr'
         from /usr/lib/ruby/1.8/rexml/encoding.rb:47:in `each_with_index'
         from /usr/lib/ruby/1.8/rexml/xpath_parser.rb:276:in `expr'
         from /usr/lib/ruby/1.8/rexml/xpath_parser.rb:125:in `match'
         from /usr/lib/ruby/1.8/rexml/xpath_parser.rb:56:in `parse'
         from /usr/lib/ruby/1.8/rexml/xpath.rb:30:in `first'
         from /usr/lib/ruby/1.8/rexml/element.rb:812:in `[]'
         from ./tst.rb:33

I get a match if I remove the newline between <table> and </table> in the xpath expression and in the xml source.

What's the problem? How do I work around it?

my ruby version: ruby 1.8.3 (2005-09-21) [i386-linux]

require 'rexml/document'

doc_xml = <<EOF
<TS>
   <context>
     <name>DisplaySetItemWidget</name>
     <message>
       <source>&lt;table&gt;
&lt;/table&gt;</source>
       <translation type='unfinished'></translation>
     </message>
   </context>
</TS>
EOF

doc = REXML::Document.new doc_xml

ctx_elem = doc.elements["/TS/context[name='DisplaySetItemWidget']"]

expr = <<EOF
message[source="<table>
</table>"]
EOF

msg_elem = ctx_elem.elements[expr]

puts msg_elem