-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
not() function failing on boolean sequence #2308
Comments
Similarly, these expressions return the same error when they should not: (true(), false())[not(.)]
(1, 2)[not(.)]
("a", "b")[not(.)] The full error message:
This error message is incorrect in two respects:
|
So I took a quick look into this. Unfortunately the root of the problem is that eXist-db's parser and XQuery engine does not correctly understand There are two hacks that I could implement to fix this:
The correct fix is to correct the XQuery Parser so that it correctly differentiates between This is not a small piece of work, and as the existing XQuery Parser is outdated (Antlr2) and contains many other lurking issue, I think it is unlikely I will fix this personally. My efforts are more focued on a new XQuery Parser and Engine. However, anyone else is welcome to take a stab at fixing it in eXist-db... |
@wolfgangmm any comments, perhaps you see an alternative path for fixing this? |
eXist handles |
As Erik mentions, the temporary workaround is: |
I just found out that wrapping declare function local:wrappedNot($a) { not($a) };
(true(), true(), true(), false(), true())[local:wrappedNot(.)] |
I created some tests on my way to this discovery. If you think they - or some of them - are useful, I can prepare a PR. |
yes please if you could create a pr with both pending test and some that are passing like the wrapped function thingy that would be great. If you could also add some xqdoc comments with a link to the issue number that would be nice, thx. |
What is the problem
The
not()
function used in a predicate on a boolean sequence fails... I'm trying to count the number of false or true entries in a sequence of booleans.count((true(), false(), false())[not(.)])
fails with the message: item of '(true, false, false)...' is not a node, and sequence length > 1count((true(), false(), false())[. eq false()])
workscount((true(), false(), false())[.])
worksNow 1.i. looks like a bug. In XSLT (Saxon) it simply works.
What did you expect
That this expression
count((true(), false(), false())[not(.)])
works as expected and as it does in Saxon.Describe how to reproduce or add a test
Run the attached XQuery
Context information
The text was updated successfully, but these errors were encountered: