Description
The functx:sequence-node-equal function returns a boolean value indicating whether the two arguments have the same nodes, in the same order. They are compared based on node identity, not their contents.
Arguments and Return TypeName | Type | Description |
$seq1 |
node()* |
the first sequence of nodes |
$seq2 |
node()* |
the second sequence of nodes |
return value |
xs:boolean |
XQuery Function DeclarationSee XSLT definition. | declare namespace functx = "http://www.functx.com";
declare function functx:sequence-node-equal
( $seq1 as node()* ,
$seq2 as node()* ) as xs:boolean {
every $i in 1 to max((count($seq1),count($seq2)))
satisfies $seq1[$i] is $seq2[$i]
} ; |
Exampleslet $in-xml := | <authors>
<author>
<fName>Kate</fName>
<lName>Jones</lName>
</author>
<author>
<fName>John</fName>
<lName>Doe</lName>
</author>
</authors> | let $anAuthor := | <author>
<fName>Kate</fName>
<lName>Jones</lName>
</author> | return |
XQuery Example | Results | Explanation |
---|
functx:sequence-node-equal(
$in-xml/author/*, $in-xml/*/*) |
true |
functx:sequence-node-equal(
$in-xml/author,
($in-xml/author[2],$in-xml/author[1])) |
false |
The order of the nodes is different. |
functx:sequence-node-equal(
$in-xml/author[1],$anAuthor) |
false |
Although the nodes have the same content, they are not the same node. |
See AlsoHistory |
Recommended Reading:
|