Skip to content

[BUG] XQuery fails to select node with true predicate #4958

@Twilight-Shuxin

Description

@Twilight-Shuxin

Describe the bug
A clear and concise description of what the bug is.
Give XML document

<F id="1"/>

and XPath Query

//F[boolean(count(@id >= 2))]

eXist returns 0 element

Expected behavior
A clear and concise description of what you expected to happen.

Should return F node as count(false()) = 1 and boolean(1) = true() Executing //F/boolean(count(@id >= 2)) in eXist returns true as expected.

To Reproduce

xquery version "3.1";

module namespace t="http://exist-db.org/xquery/test";

declare namespace test="http://exist-db.org/xquery/xqsuite";

declare variable $t:XML := document {
    <F id="1"/>
};

declare
    %test:setUp
function t:setup() {
    xmldb:create-collection("/db", "test"),
    xmldb:store("/db/test", "test.xml", $t:XML)
};

declare
    %test:tearDown
function t:tearDown() {
    xmldb:remove("/db/test")
};

declare
    %test:assertTrue
function t:test-db() {
    exists(
        doc("/db/test/test.xml")//F[boolean(count(@id >= 2))]
    )
};

declare
    %test:assertTrue
function t:test-mem() {
    exists(
        $t:XML//F[boolean(count(@id >= 2))]
    )
};

Context (please always complete the following information)

  • Build: latest development version built from source, commit efb1498
  • Java: 17
  • OS: [Windows]

Additional context

  • How is eXist-db installed? Jar installer
  • Any custom changes in e.g. conf.xml? No

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugissue confirmed as buginvestigateissues being looked atxqueryissue is related to xquery implementation

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions