This list is for Saxon-specific queries, not for general XQuery coding assistance. You can get that much more effectively on StackOverflow.

Your query is not valid because you are referring to $a within its own definition.

I think you need to explain your requirements more carefully; One could argue that "9" should not be in the list because it contains "9". It would also be good to know how much the problem has to scale. And people would be more likely to help you if the problem looked like something from real life.

Michael Kay

On 15 May 2013, at 14:05, Kunal Chauhan wrote:


I want to maintain list of value, when any output comes it will check under the list if that value is in the list it will not add that value
otherwise it will add value into the list.

I write a simple query like

let $a := for $i in 1 to 10
            let $b := if(contains($a,$i))then()else($i)
          return $b

return $a

here every iteration will give output to $a, so at every iteration i check whether current number is present under the output list ?

I am expecting something like whenever I print $a it will give below output

1 2 3 4 5 6 7 8 9

10 should not be there because it contains 1.

any clue?

Kunal Chauhan
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
saxon-help mailing list archived at