Ticket #114 (closed defect: invalid)

Opened 16 months ago

Last modified 16 months ago

cannot use variable to match attribute value when ..

Reported by: bbuff1 Owned by: ser
Priority: highest Milestone:
Component: XPath Version: 3.1.4
Severity: critical Keywords:
Cc: Ruby version: 1.8.5
Operating system: Unix

Description (last modified by ser) (diff)

example The following code works:

x.root.elements["definition[@name='accountBalance']"]

But the following code does not work

test = 'accountBalance'
x.root.elements["definition[@name=test]"]

Change History

Changed 16 months ago by ser

  • status changed from new to closed
  • resolution set to invalid
  • description modified (diff)

Why would this ever work? This code doesn't mean what you think it means, even in Ruby, much less REXML. Was there a typo in the bug report? Try the following:

test = 'accountBalance'
x.root.elements["definition[@name='#{test}']"]
Note: See TracTickets for help on using tickets.