如何通过 xquery 过滤获取整个 xml 文件,而不仅仅是与过滤对应的节点?

How can I via xquery filtering get the whole xml file and not only the nodes that correspond to the filtering?

是否可以在 xquery 中使用过滤来获取聚合的 xml 文件?

我有以下 xquery 命令

xquery declare default element namespace  \"http://www.satisfactory-project.eu/XMLSchema/v1.0/common\"; collection('vagelisdb')/SensorInfo/Position[x>4]

我得到过滤后的节点,但它们只包含 xml 的一部分,而不是整个 xml。

<Position xmlns="http://www.satisfactory-project.eu/XMLSchema/v1.0/common"><x>10</x><y>12</y><z>20</z><Unit>Meters</Unit></Position>

我想得到

<?xml version="1.0" encoding="UTF-8"?><SensorInfo xmlns="http://www.satisfactory-project.eu/XMLSchema/v1.0/common">
<ID>sensor_1</ID>
<Type>DepthCamera</Type>
<Position>
    <x>10</x>
    <y>12</y>
    <z>20</z>
    <Unit>Meters</Unit>
</Position>
<Space>Edw</Space>

当然,您只需要将文档用作谓词上下文节点而不是该元素:

collection('vagelisdb')[SensorInfo/Position/x>4]