Description
The functx:distinct-attribute-names function returns the distinct set of attribute names that exist on nodes in $nodes or their descendants.
Arguments and Return TypeName | Type | Description |
$nodes |
node()* |
the root to start from |
return value |
xs:string* |
XQuery Function DeclarationSee XSLT definition. | declare namespace functx = "http://www.functx.com";
declare function functx:distinct-attribute-names
( $nodes as node()* ) as xs:string* {
distinct-values($nodes//@*/name(.))
} ; |
Exampleslet $in-xml := | <authors a1="xyz">
<author a2="abc">
<fName a3="def">Kate</fName>
<lName>Jones</lName>
</author>
<author>
<fName a3="def">John</fName>
<lName>Doe</lName>
</author>
</authors> | return |
XQuery Example | Results |
---|
functx:distinct-attribute-names($in-xml) |
('a1', 'a2', 'a3') |
See AlsoHistory |
Recommended Reading:
|