How can I extract the value of an attribute node via XPath?
A sample XML file is:
You should use //Parent[@id='1']/Children/child/data(@name)
//Parent[@id='1']/Children/child/data(@name)
The attributes can not be serialized so you can't return them in an xml looking result. What you need to do is obtain the data from the attribute using data() function.