Skip to content

Reject underscored XPath function names - #366

Open
sjh9714 wants to merge 2 commits into
ruby:masterfrom
sjh9714:codex/20260830-352-reject-underscored-xpath-function
Open

Reject underscored XPath function names#366
sjh9714 wants to merge 2 commits into
ruby:masterfrom
sjh9714:codex/20260830-352-reject-underscored-xpath-function

Conversation

@sjh9714

@sjh9714 sjh9714 commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #352.

Reject XPath function names containing underscores instead of treating them as
aliases for hyphenated standard functions. Standard names such as
local-name() continue to parse normally.

Changes

  • Stop underscored names from being parsed as XPath function calls.
  • Update XPath fixtures to use standard hyphenated names and add regression
    coverage.

Testing

  • ruby -Itest -Ilib test/parser/test_xpath.rb --name=test_function_with_underscore
  • rake test

@kou

kou commented Aug 30, 2026

Copy link
Copy Markdown
Member

I want to keep backward compatibility as much as possible.

How about rejecting _ only when a user specify an option explicitly?

@sjh9714

sjh9714 commented Aug 30, 2026

Copy link
Copy Markdown
Contributor Author

Updated this so underscored function names remain accepted by default and are rejected only when the existing strict: true option is passed. The low-level XPath parser now receives that option, and the tests cover both default compatibility and strict rejection.

Ran:

  • ruby -Ilib:test test/parser/test_xpath.rb
  • ruby -Ilib:test test/functions/test_base.rb
  • ruby -Ilib:test test/run.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XPath underscored function name is wrongly accepted

2 participants