home contribute faq download

FunctX XQuery Functions

functx:is-node-in-sequence-deep-equal

Whether an XML node is in a sequence, based on contents and attributes

Google
Webdatypic.com

Description

The functx:is-node-in-sequence-deep-equal function returns a boolean value indicating whether or not a node has the same contents as a node in a sequence. It determines whether the nodes have the same content using the built-in fn:deep-equal function. If $node or $seq is the empty sequence, it returns false.

For a similar function based on the identity of a node rather than its contents, see functx:is-node-in-sequence.

Arguments and Return Type

NameTypeDescription
$node node()? the node to test
$seq node()* the sequence of nodes to search
return value xs:boolean

XQuery Function Declaration

See XSLT definition.
declare namespace functx = "http://www.functx.com";
declare function functx:is-node-in-sequence-deep-equal
  ( $node as node()? ,
    $seq as node()* )  as xs:boolean {

   some $nodeInSeq in $seq satisfies deep-equal($nodeInSeq,$node)
 } ;

Examples

let $in-xml :=
<authors>
   <author>
      <fName>Kate</fName>
      <lName>Jones</lName>
   </author>
   <author>
      <fName>John</fName>
      <lName>Doe</lName>
   </author>
</authors>
let $anAuthor :=
<author>
  <fName>John</fName>
  <lName>Doe</lName>
</author>
return
XQuery ExampleResults
functx:is-node-in-sequence-deep-equal(
     $in-xml/author[1],$in-xml/author)
true
functx:is-node-in-sequence-deep-equal(
         $anAuthor,$in-xml/author)
true
functx:is-node-in-sequence-deep-equal(
     $in-xml/author[1],$in-xml)
false

See Also

functx:is-value-in-sequenceWhether an atomic value appears in a sequence
functx:is-node-in-sequenceWhether an XML node is in a sequence, based on node identity
functx:distinct-deepThe XML nodes with distinct values, taking into account attributes and descendants
fn:deep-equalWhether two nodes have the same content and attributes

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, https://www.datypic.com
Datypic XQuery Services

Recommended Reading:

XQuery