Description
The functx:sequence-node-equal-any-order function returns a boolean value indicating whether the two arguments have the same nodes, in any order. They are compared based on node identity, not their contents.
Arguments and Return Type| Name | Type | Description |
$seq1 |
node()* |
the first sequence of nodes |
$seq2 |
node()* |
the second sequence of nodes |
| return value |
xs:boolean |
XQuery Function Declaration| See XSLT definition. | | XQuery Syntax for July 2004 - January 2007 (1.0): |
|---|
declare namespace functx = "http://www.functx.com";
declare function functx:sequence-node-equal-any-order
( $seq1 as node()* ,
$seq2 as node()* ) as xs:boolean {
not( ($seq1 except $seq2, $seq2 except $seq1))
} ; | | XQuery Syntax for May 2003: |
|---|
declare namespace functx = "http://www.functx.com"
define function sequence-node-equal-any-order
( $seq1 as node()* ,
$seq2 as node()* ) as xs:boolean {
fn:not( ($seq1 except $seq2, $seq2 except $seq1))
} |
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 |
|---|
functx:sequence-node-equal-any-order(
$in-xml/author, $in-xml/*)
|
true
|
functx:sequence-node-equal-any-order(
$in-xml/author,
($in-xml/author[2],$in-xml/author[1]))
|
true
|
functx:sequence-node-equal-any-order(
$in-xml/author[1],$anAuthor)
|
false
|
See AlsoHistory |
|