# array:insert-before - XPath XQuery Reference

Returns an array containing all the members of the supplied array, with one additional member at a specified position.deterministiccontext-independentfocus-independentThe function returns an array of size array:size($array) + 1 containing all members from $array
            whose position is less than $position, then a new member given by $member, and
            then all members from $array whose position is greater than or equal to $position. 
            Positions are counted from 1.The result is equivalent to the result of the expression
         array:join( (array:subarray($array, 1, $position - 1), [$member], array:subarray($array, $position)) )array:insert-before(["a", "b", "c", "d"], 3, ("x", "y"))["a", "b", ("x", "y"), "c", "d"]array:insert-before(["a", "b", "c", "d"], 5, ("x", "y"))["a", "b", "c", "d", ("x", "y")]array:insert-before(["a", "b", "c", "d"], 3, ["x", "y"])["a", "b", ["x", "y"], "c", "d"]A dynamic error occurs  if $position is not in the range 1 to
            array:size($array) + 1 inclusive.Setting $position to 1 has the effect of prepending the new member at the start of the array. Setting $position
         to the value array:size($array) + 1 delivers the same result as array:append($array, $member).