When an xs:integer is converted to an xs:long (using either a cast or the xs:long() constructor function), the original value is returned unchanged.
Source code fixed.
Circumvention: use xs:long(string($int))