In XPath 2.0 (which is a subset of XQuery), you can use the following expression to retrieve the sequence of all string values ββfor the "name" attributes of the "Section" elements:
for $attr in //Section/@name return string($attr)
Please note that using the abbreviation "//" is usually bad practice, as this may require moving the whole (subtree). In any case, when the document structure is known, a more specific XPath expression should be preferred (for example, one using specific location steps).
source share