通过检查其所有后继元素节点值是否大于某个固定值来输出 XML 个节点?

Output XML nodes by checking if all their successors elements nodes values are greater than a certain fixed value?

我有以下文档,我想 select 所有节点及其关联的 ID,当且仅当它们的所有后继节点元素都大于 300。

<item>
    <deposit id="1">
        <amount>1200</amount>
        <amount>5000</amount>
        <amount>2300</amount>
    </deposit>
    <deposit id="2">
        <amount>300</amount>
        <amount>1500</amount>
        <amount>700</amount>
    </deposit>
    <deposit id="3">
        <amount>300</amount>
        <amount>500</amount>
        <amount>700</amount>
    </deposit>
    <deposit id="4">
        <amount>300</amount>
    </deposit>
    <deposit id="5">
        <amount>3500</amount>
    </deposit>
    <deposit id="6">
        <amount>1000</amount>
    </deposit>
</item>

我已经尝试 运行 以下 XQuery 块,但它给我的结果与上述文档相同,没有任何更改。

let $e := $depot/deposit
for $a in $e/amount
return if (data($a/preceding-sibling::amount)>"300") then $e else ()

我希望得到如下查询结果,

<item>
    <deposit id="1">
        <amount>1200</amount>
        <amount>5000</amount>
        <amount>2300</amount>
    </deposit>
    <deposit id="5">
        <amount>3500</amount>
    </deposit>
    <deposit id="6">
        <amount>1000</amount>
    </deposit>
</item>

这应该会让您获得所需的输出:

let $item := //deposit[not(amount[text()<=300])]

return 
(<item>
{$item}
</item>)