Description
The functx:siblings function returns the siblings of a node (but not the node itself). This does not include attributes, but does include elements, text nodes, processing instructions and comments.
Arguments and Return TypeName | Type | Description |
$node |
node()? |
the node |
return value |
node()* |
XQuery Function DeclarationSee XSLT definition. | declare namespace functx = "http://www.functx.com";
declare function functx:siblings
( $node as node()? ) as node()* {
$node/../node() except $node
} ; |
Exampleslet $in-xml := | <authors a1='xyz'>
<author a2='abc'>
<fName a3='def'>Kate</fName>
<fName a3='def'>Jane</fName>
<lName>Jones</lName>
</author>
<author>
<fName a3='def'>John</fName>
<lName>Doe</lName>
</author>
</authors> | return |
XQuery Example | Results |
---|
functx:siblings(
$in-xml/author[1]) |
<author>
<fName a3="def">John</fName>
<lName>Doe</lName>
</author> |
functx:siblings(
$in-xml/author[1]/fName[2]) |
<fName a3="def">Kate</fName>
<lName>Jones</lName> |
See AlsoHistory |
Recommended Reading:
|