Description
The functx:distinct-element-paths function returns a sequence of strings representing the paths of elements that are in $nodes or among their descendants.
Arguments and Return Type| Name | Type | Description |
$nodes |
node()* |
the root(s) to start from |
| return value |
xs:string* |
XQuery Function Declaration| See XSLT definition. | | XQuery Syntax for July 2004 - January 2007 (1.0): |
|---|
declare namespace functx = "http://www.functx.com";
declare function functx:distinct-element-paths
( $nodes as node()* ) as xs:string* {
distinct-values(functx:path-to-node($nodes/descendant-or-self::*))
} ; | | XQuery Syntax for May 2003: |
|---|
declare namespace functx = "http://www.functx.com"
define function distinct-element-paths
( $nodes as node()* ) as xs:string* {
fn:distinct-values(functx:path-to-node($nodes/descendant-or-self::*))
} |
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-paths(
$in-xml)
|
('authors',
'authors/author',
'authors/author/fName',
'authors/author/lName')
|
functx:distinct-element-paths(
$in-xml/author[1])
|
('authors/author',
'authors/author/fName',
'authors/author/lName')
|
Depends OnSee AlsoHistory |
|