Description
The functx:siblings-same-name function returns the siblings of an element that have the same qualified name. It returns only other elements, not attributes, and not the element itself.
Arguments and Return TypeName | Type | Description |
$element |
element()? |
the node |
return value |
element()* |
XSLT Function DeclarationSee XQuery definition. | <xsl:function name="functx:siblings-same-name" as="element()*"
xmlns:functx="http://www.functx.com">
<xsl:param name="element" as="element()?"/>
<xsl:sequence select="
$element/../*[node-name(.) = node-name($element)]
except $element
"/>
</xsl:function>
|
Examples<xsl:variable name="in-xml" as="item()*"> | | <authors>
<author>
<fName>Kate</fName>
<fName>Jane</fName>
<lName>Jones</lName>
</author>
<author>
<fName>John</fName>
<lName>Doe</lName>
</author>
</authors> |
| </xsl:variable> |
XPath Example | Results |
---|
functx:siblings-same-name(
$in-xml/author[1]) |
<author>
<fName>John</fName>
<lName>Doe</lName>
</author> |
functx:siblings-same-name(
$in-xml/author[1]/fName[2]) |
<fName>Kate</fName> |
See AlsoHistory |
Recommended Reading:
|