home contribute faq download

FunctX XQuery Functions

functx:siblings

The siblings of an XML node

Google
Webdatypic.com

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 Type

NameTypeDescription
$node node()? the node
return value node()*

XQuery Function Declaration

See XSLT definition.
declare namespace functx = "http://www.functx.com";
declare function functx:siblings
  ( $node as node()? )  as node()* {

   $node/../node() except $node
 } ;

Examples

let $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 ExampleResults
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 Also

functx:siblings-same-nameThe siblings of an XML element that have the same name

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, http://www.datypic.com
Datypic XQuery Services

Recommended Reading:

XQuery