If I have several Section elements in an XML document, what XQuery do I use to get a list of all the name values?
<Section name='New Clients' filePath='XNEWCUST.TXT' skipSection='False'>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In XPath 2.0 (which is a subset of XQuery) one would use the following expression to get a sequence of all string values of the ‘name’ attributes of the ‘Section’ elements:
Do note that using the ‘//’ abbreviation is typically a bad practice as this may require a whole (subtree) to be traversed. In any case where the structure of the document is known a more specific XPath expression (such as one using specific location steps) should be preferred.