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

XQuery: Bug on node selection with last() #2191

Closed
Twilight-Shuxin opened this issue Mar 23, 2023 · 3 comments
Closed

XQuery: Bug on node selection with last() #2191

Twilight-Shuxin opened this issue Mar 23, 2023 · 3 comments
Labels

Comments

@Twilight-Shuxin
Copy link

Twilight-Shuxin commented Mar 23, 2023

Description of the Problem

Given this XML document:

<A1 id="1">
  <B1 id="2"></B1>
  <C1 id="3"></C1>
</A1>

and XPath Query

//*[head(./*/last()) <= 1]

BaseX gives result

<A1 id="1"><B1 id="2"/><C1 id="3"/></A1>

Expected Behavior

Should return empty result set as Saxon & Exist.

When executing //A1/*/last(), BaseX returns 2, 2; Therefore the condition is false and node A1 should not be selected.

Steps to Reproduce the Behavior

  1. Create database create database test
  2. Insert XML file into database put test.xml path/to/file
  3. Execute XPath query xquery //*[head(./*/last()) <= 1]

Do you have an idea how to solve the issue?

No response

What is your configuration?

BaseX version: Newest development version from Github, commit 95e6aaa

@ChristianGruen
Copy link
Member

Thanks again. A simplified version (returns 1 instead of 2):

<a><b/><b/></a> ! head(*/last())

@ChristianGruen
Copy link
Member

Fixed (head(*/last() was erroneously rewritten to head(*) ! last())

@Twilight-Shuxin
Copy link
Author

Thanks again! :)

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

No branches or pull requests

2 participants