REXML translate (XPath?)

Can somebody explain or put me to an explanation of how to use
REXML::Functions::translate ?

I’d like to turn this: group_list.elements[“entry[title=’#{name}’]”]

. . . into a case insensitive lookup. Do I put the translation into
the XPath in that line? Do I need a separate translation line?

Thanks,
Andrew

On Feb 11, 7:42 pm, “Andrew C.” [email protected] wrote:

Can somebody explain or put me to an explanation of how to use
REXML::Functions::translate ?

I’d like to turn this: group_list.elements[“entry[title=‘#{name}’]”]

. . . into a case insensitive lookup. Do I put the translation into
the XPath in that line? Do I need a separate translation line?

Thanks,
Andrew

This would be the correct XPath:

group_list.elements[“entry[translate(title,
‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’,
‘abcdefghijklmnopqrstuvwxyz’)=‘#{name.downcase}’]”]

but I don’t know if REXML can handle it, because it’s not fully XPath
compliant. I’d use an XPath-compliant parser like Nokogiri if this is
an issue.

– Mark.

That appears to work for REXML. Thanks Mark.