Skip to content

XPath function string-length without argument not working #332

@tompng

Description

@tompng
# Expected
Nokogiri::XML.parse('<root><item>123</item><item>1234</item><item>12345</item></root>').xpath('//*[string-length()=4]')
# => [#<Nokogiri::XML::Element:0x1450 name="item" children=[#<Nokogiri::XML::Text:0x1448 "1234">]>]

# Actual
REXML::XPath.match(REXML::Document.new('<root><item>123</item><item>1234</item><item>12345</item></root>'), '//*[string-length()=4]')
# => 'REXML::Functions.string_length': wrong number of arguments (given 0, expected 1) (ArgumentError)

REXML::VERSION
# => "3.4.4"

string-length with argument seems to be working as expected

Nokogiri::XML.parse('<root/>').xpath('string-length("hello")')
# => 5.0

REXML::XPath.match(REXML::Document.new('<root/>'), 'string-length("hello")')
# => [5]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions