Description
The functx:distinct-element-names function returns the distinct set of element names that exist in $nodes or among the descendants of $nodes .
Arguments and Return TypeName | Type | Description |
$nodes |
node()* |
the root(s) to start from |
return value |
xs:string* |
XQuery Function DeclarationSee XSLT definition. | declare namespace functx = "http://www.functx.com";
declare function functx:distinct-element-names
( $nodes as node()* ) as xs:string* {
distinct-values($nodes/descendant-or-self::*/name(.))
} ; |
Exampleslet $in-xml := | <authors>
<author>
<fName>Kate</fName>
<lName>Jones</lName>
</author>
<author>
<fName>John</fName>
<lName>Doe</lName>
</author>
</authors> | return |
XQuery Example | Results |
---|
functx:distinct-element-names($in-xml) |
('authors',
'author',
'fName',
'lName') |
functx:distinct-element-names(
$in-xml/author[1]) |
('author',
'fName',
'lName') |
Depends OnSee AlsoHistory |
Recommended Reading:
|