Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behaviour for XPath s modifier #72

Open
alexcastano opened this issue May 24, 2019 · 1 comment
Open

Unexpected behaviour for XPath s modifier #72

alexcastano opened this issue May 24, 2019 · 1 comment

Comments

@alexcastano
Copy link

Version 0.6.6

Using the README example:

iex(3)> result = doc |> xpath(~x"//matchup/name/text()")
'Match One'
iex(4)> result = doc |> xpath(~x"//matchup/name/text()"s)
"Match OneMatch TwoMatch Three"

For the s modifier, I would expect the result: "Match One"

@bmfay
Copy link

bmfay commented Jul 29, 2021

I've noticed this as well. In the former case it will give you the first match as a sigil, but when you add the s modifier, it will give you all matches concatenated. Depending on context, you may be able to isolate the particular node you are looking for and then do

 ~x"./matchup/name/text()"s

In which case you'd see the expected result.

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

No branches or pull requests

2 participants