Description
The functx:sequence-deep-equal function returns a boolean value indicating whether the two sequences have the same content or values, in the same order. To compare items, it uses the built-in fn:deep-equal function. The argument sequences can contain nodes or atomic values or both. For nodes, it compares them based on their contents and attributes, not their node identity. For atomic values, it compares them based on their typed values.
Arguments and Return Type| Name | Type | Description |
$seq1 |
item()* |
the first sequence |
$seq2 |
item()* |
the second sequence |
| 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-deep-equal
( $seq1 as item()* ,
$seq2 as item()* ) as xs:boolean {
every $i in 1 to max((count($seq1),count($seq2)))
satisfies deep-equal($seq1[$i],$seq2[$i])
} ; | | XQuery Syntax for May 2003: |
|---|
declare namespace functx = "http://www.functx.com"
define function sequence-deep-equal
( $seq1 as item()* ,
$seq2 as item()* ) as xs:boolean {
every $i in 1 to fn:max((fn:count($seq1),fn:count($seq2)))
satisfies fn:deep-equal($seq1[$i],$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 |
|---|
functx:sequence-deep-equal(
$in-xml/author/*, $in-xml/*/*)
|
true
|
functx:sequence-deep-equal(
$in-xml/author[1], $anAuthor)
|
true
|
functx:sequence-deep-equal(
(1,2,3), (1.0,2.0,3.0))
|
true
|
See AlsoHistory |
|