Can [position() = 0] return multiple nodes?


I must admit, that I am unsure, whether the
following is a bug. Do the following:


  • Insert the attached document into ino:etc.
  • Perform the following query:

       for $b in input()/open_auction[@id='open_auction2']
       return <a>{$b/bidder[position() = 0]}</a> 

    Note, that the query returns one element
    (a) with two child elements (bidder). IMO
    this ought not to be the case.

    Did I trigger a bug or do I misunderstand
    the concept?
    open_auction.xml (1.8 KB)

  • Hi,

    It seems that you have found a bug. Since the first position in the child sequence of an element node has the position 1, the correct result of your query is a single empty ?a? element.

    Best regards,

    Thorsten Fiebig