how to select attribute value of a node in XQuery? how to select attribute value of a node in XQuery? xml xml

how to select attribute value of a node in XQuery?


You should use data to pick attribute value:-

for $c in /company/customers/customerreturn data($c/@cno)


You can also use string to get attribute value:

for $c in /company/customers/customer    return $c/@cno/string()