Reputation: 2010
Suppose I have an XML-
<SearchPage ID="123" version="1.3" xmlns="http://some/path">
.....some child elements
</SearchPage>
How to get all the attribute names from it?
Upvotes: 1
Views: 415
Reputation: 38732
Use the name()
function, or local-name()
if you want to omit attribute namespaces.
let $node := <SearchPage ID="123" version="1.3" xmlns="http://some/path">
.....some child elements
</SearchPage>
for $attribute in $node/attribute()
return $attribute/name()
with result:
ID
version
Upvotes: 5