A wrong result is returned when a numeric predicate based on function
last() is applied to a sequence that was built from values of a positional
variable, e.g.

        (for $x at $i in (1, 2) return $i)[last()]
returns 4, but should be 2. Seems like the result is always doubled.

Best regards,

Software AG – Sitz/Registered office: Uhlandstraße 12, 64297 Darmstadt, Germany, – Registergericht/Commercial register: Darmstadt HRB 1562 - Vorstand/ Management Board: Karl-Heinz Streibich (Vorsitzender/Chairman), David Broadbent, Mark Edwards, Dr. Peter Kürpick, David Mitchell, Arnd Zinnhardt; - Aufsichtsratsvorsitzender/ Chairman of the Supervisory Board: Frank F. Beelitz - http://www.softwareag.com