How to select two attributes from the same node with one expression in XPath?

前端 未结 4 1246
悲&欢浪女
悲&欢浪女 2020-12-04 18:59

For example:

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

PS. there are lots of \"person\" records

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-04 19:38

    Are you wanting to search for person nodes based on the value of multiple attributes. If that's the question then you can just use ands e.g.

    //person[@id='abc123' and @haircolor='blue' and @weight='...']
    

    If you want to search on a single attribute, but return the values of the other attributes, I would do something like this:

     
         
         
      
    

提交回复
热议问题