Extract value of attribute node via XPath

后端 未结 7 1034
醉酒成梦
醉酒成梦 2020-11-28 01:59

How can I extract the value of an attribute node via XPath?

A sample XML file is:


  

        
相关标签:
7条回答
  • 2020-11-28 02:33

    To get just the value (without attribute names), use string():

    string(//Parent[@id='1']/Children/child/@name)

    The fn:string() fucntion will return the value of its argument as xs:string. In case its argument is an attribute, it will therefore return the attribute's value as xs:string.

    0 讨论(0)
提交回复
热议问题