Noor
Noor

Reputation: 20150

XQuery node is sequence

Is is-node-in-sequence-deep-equal in XQuery? I'm wondering because I've seen the function at xqueryfunctions.com, but I'm not being able to use it.

Upvotes: 1

Views: 369

Answers (1)

Sicco
Sicco

Reputation: 6281

That function is part of the FunctX XQuery library. There are two methods to use this function:

  1. You download the whole library (select the download which corresponds to your version of XQuery), save it in the same directory as your XQuery program/file and then import the module in your XQuery file, e.g.:

    import module namespace functx = "http://www.functx.com" at "functx-1.0-doc-2007-01.xq";
    
    (: Insert your code here and call the is-node-in-sequence-deep-equal function as seen below :)
    
    functx:is-node-in-sequence-deep-equal($node, $seq)
    
  2. Instead of downloading the whole library with all functions you can also simply copy paste the specific function which you need as shown on the page you linked to:

    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)
     } ;
    
    (: Insert your code here and call the 'is-node-in-sequence-deep-equal' function as seen below :)
    
    functx:is-node-in-sequence-deep-equal($node, $seq)
    

In both examples you simply replace $node and $seq with your variables.

Upvotes: 2

Related Questions