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

Does not use internal result of xpath expression #22

Open
yshrini opened this issue Apr 26, 2018 · 2 comments
Open

Does not use internal result of xpath expression #22

yshrini opened this issue Apr 26, 2018 · 2 comments

Comments

@yshrini
Copy link

yshrini commented Apr 26, 2018

I am exploring use of this library and found that if there is sub xpath expression, evaluation throws error.

e.g 1:
$(document).xpath("replace(replace('This is the test string','the',''), 'test', 'best')")
throws error
{
Code:"XPTY0004"
message:"Type is not appropriate for the context in which the expression occurs"
}
e.g 2:
$(document).xpath("contcat(concat('a', 'b'),'c')")
throws error
Code:"XPST0017"
message : Expanded QName and number of arguments in a function call do not match the name and arity of a function signature"

@ilinsky
Copy link
Owner

ilinsky commented Apr 26, 2018

concerning 1 - there is a bug in the implementation: https://github.com/ilinsky/xpath.js/blob/master/src/functions/string.js#L353 , where replace function returns boolean instead of a string (because of a typo)!, hence passing boolean second time in a replace throws error..
concerning 2 - when you correct spelling error: contcat -> concat, the return will be correct.

So, there is generally no problem with nested xpath expressions.

@ilinsky ilinsky changed the title Does not use internal result of xpath expression Replace function returns boolean rather than string Apr 26, 2018
@ilinsky ilinsky changed the title Replace function returns boolean rather than string Does not use internal result of xpath expression Apr 26, 2018
@ilinsky
Copy link
Owner

ilinsky commented Apr 26, 2018

Filled an issue ilinsky/xpath2.js#11

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

No branches or pull requests

2 participants