如何在 MSXML6 上获得 max() 的等效项?

发布于 2024-08-17 10:49:29 字数 383 浏览 2 评论 0原文

显然 MSXML6 不支持 XSLT 2.0,至少不支持 max() 函数。我需要找出其兄弟节点中包含最高值的节点。它们的顺序是任意的。

我希望订单保持相同,因此添加 order-by 并检查 [0] 是不可能的。

我想用单个 XPath 语句来完成此操作。我不想调用模板或涉及任何比这更复杂的逻辑。我确信某处嵌入了可怕的 MS 脚本扩展。呃。

我想到:

elem1[count(../elem1[@value < current()/@value]) = 0]

但它没有按我的预期工作(始终返回第一个节点)。您还能想到其他漂亮的 XPath 魔法吗?

Evidently MSXML6 doesn't support XSLT 2.0, at least not the max() function. I need to find out the node that contains the highest value among its siblings. They are in arbitrary order.

I want the order to remain identical so adding order-by and checking [0] is out of question.

I want to do this with a single XPath statement. I don't want to call templates or involve any more complex logic than that. I'm sure there is a horrifying MS Scripting Extensions embedded somewhere. Eww.

I thought of:

elem1[count(../elem1[@value < current()/@value]) = 0]

But it didn't work as I expected (returns the first node always). Any other nifty XPath magic can you think of there?

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

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

发布评论

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

评论(1

自由如风 2024-08-24 10:49:29

尝试

elem1[not(../elem1/@value > @value)]

也就是说,您想要的 elem1 不是另一个 elem1 具有更大的 @value 的情况>。

灵感来自这个方便的页面

Try

elem1[not(../elem1/@value > @value)]

That is, you want the elem1 for which it is not the case that another elem1 has a greater @value.

Inspiration from this handy page

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