如何在 MSXML6 上获得 max() 的等效项?
显然 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
也就是说,您想要的
elem1
不是另一个elem1
具有更大的@value
的情况>。灵感来自这个方便的页面
Try
That is, you want the
elem1
for which it is not the case that anotherelem1
has a greater@value
.Inspiration from this handy page