Skip to content

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

@Twilight-Shuxin

Description

@Twilight-Shuxin

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions