Closed Twilight-Shuxin closed 1 year ago
Thanks as always! reverse(tail(reverse(...)))
is rewritten to a function that will be introduced with XQuery 4.0 – fn:trunk – and the optimization rules of that function contained a bug.
Thanks also for the response speed always so impressive!
Description of the Problem
Given this XML document:
and XPath Query
BaseX returns one element false.
Expected Behavior
Should return empty result set. For node
B
,//*/has-children()
selects the result ofI, A, B
three nodes. Applying subsequence(s, 3) selects only the last element, and after application of tail function no result should be selected. In terms of number of results returned, the two reverse() operations seems redundant in this case. If deleted BaseX returns the expected results.Steps to Reproduce the Behavior
create database db <I><A/><B/></I>
xquery //B/reverse(tail(reverse(subsequence(//*/has-children(), 3))))
This is a reduced test case from:
create database db <I><A><B><C/></B></A><D/></I>
xquery //D/reverse(tail(reverse(subsequence(./preceding::*/has-children(), 3))))
Do you have an idea how to solve the issue?
No response
What is your configuration?
BaseX version: BaseX 10.7 beta latest commit 564bd39 on Windows