Skip to content

Instantly share code, notes, and snippets.

@AdamSteffanick
Forked from CliffordAnderson/except.xqy
Created April 29, 2016 20:18
Show Gist options
  • Select an option

  • Save AdamSteffanick/94d92ad956f2e03c555bf2f9ec94d535 to your computer and use it in GitHub Desktop.

Select an option

Save AdamSteffanick/94d92ad956f2e03c555bf2f9ec94d535 to your computer and use it in GitHub Desktop.
Combining Node Sequences
xquery version "3.1";
let $old-words :=
<stopwords>
<word>the</word>
<word>a</word>
<word>in</word>
<word>of</word>
<word>as</word>
</stopwords>
let $new-words :=
element stopwords {
$old-words/word except $old-words/word[4]
}
return $new-words
xquery version "3.1";
(: union, intersect, except :)
let $seq := (<name>Arnold</name>, <name>Betty</name>, <name>Claire</name>)
let $seq1 := ($seq[1], $seq[2])
let $seq2 := ($seq[1], $seq[2])
let $seq3 := ($seq[2], $seq[3])
return $seq1 except $seq3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment