如何在XPath中选择相同的节点与一个前pression两个属性? [英] How to select two attributes from the same node with one expression in XPath?

查看:189
本文介绍了如何在XPath中选择相同的节点与一个前pression两个属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如:

//person[@id='abc123']/@haircolor|/@weight"

PS。有大量的人的记录

PS. there are lots of "person" records

推荐答案

试试这个:

//person[@id='abc123']/@*[name()='weight' or name()='haircolor']

如果您正在使用XPath 2.0处理器,您还可以使用prettier选项:

If you're using an XPath 2.0 processor, you may also use a prettier option:

//person[@id='abc123']/(@haircolor|@weight)`

这篇关于如何在XPath中选择相同的节点与一个前pression两个属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆