home contribute faq download

FunctX XSLT 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()*

XSLT Function Declaration

See XQuery definition.
<xsl:function name="functx:siblings" as="node()*"
              xmlns:functx="http://www.functx.com">
  <xsl:param name="node" as="node()?"/>

  <xsl:sequence select="
   $node/../node() except $node
 "/>

</xsl:function>

Examples

<xsl:variable name="in-xml" as="item()*">
<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>
</xsl:variable>
XPath 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, https://www.datypic.com
Datypic XSLT Services

Recommended Reading:

XQuery