Xquery所有功能

发布于 2024-10-01 13:39:46 字数 147 浏览 0 评论 0原文

这可能看起来是一个愚蠢的问题,但我已经用谷歌搜索了十五分钟,但似乎找不到我要找的东西。我确定特定集合中的所有节点是否对于给定谓词返回 true。例如,如果我有一组整数节点,我可能想知道它们是否都大于 5。这看起来很简单,但我似乎找不到要使用的关键字或函数。

谢谢。

This'll probably seem like a stupid question, but I've been Googling for fifteen minutes and can't seem to find what I'm looking for. I to determine if all of the nodes in a particular set return true for a given predicate. For example, if I have a set of integer nodes, I might want to know if all of them are greater than 5. This seems simple enough, but I can't seem to find a keyword or function to use.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鸵鸟症 2024-10-08 13:39:46

这些称为量化表达式。来自 http://www.w3.org/TR/xpath20/#id-量化表达式

量化表达式支持
存在性和普遍性
量化。的值
量化表达式总是正确的
或错误。

QuantifiedExpr ::= ("一些" |
"每个") "$" VarName "in" ExprSingle
("," "$" VarName "in" ExprSingle)*
“满足”ExprSingle

此 XQuery 表达式:

every $num in /test/num/number() satisfies $num gt 5

使用此输入:

<test>
  <num>3</num>
  <num>4</num>
  <num>5</num>
</test>

结果:

false

注意:XQuery 1.0 是 XPath 2.0 的超集

These are called Quantified Expressions. From http://www.w3.org/TR/xpath20/#id-quantified-expressions

Quantified expressions support
existential and universal
quantification. The value of a
quantified expression is always true
or false.

QuantifiedExpr ::= ("some" |
"every") "$" VarName "in" ExprSingle
("," "$" VarName "in" ExprSingle)*
"satisfies" ExprSingle

This XQuery expression:

every $num in /test/num/number() satisfies $num gt 5

With this input:

<test>
  <num>3</num>
  <num>4</num>
  <num>5</num>
</test>

Result:

false

Note: XQuery 1.0 is a superset of XPath 2.0

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文