bin:pack-integer

Returns the twos-complement binary representation of an integer value as a binary value of a given size.

pack-integer($value as xs:integer, $size as xs:integer, $order as enum('least-significant-first', 'little-endian', 'LE', 'most-significant-first', 'big-endian', 'BE')?:='most-significant-first') ➔ xs:base64Binary

Arguments

 

$value

xs:integer

The value to pack

 

$size

xs:integer

The octet length to pack within

 

$order

enum('least-significant-first', 'little-endian', 'LE', 'most-significant-first', 'big-endian', 'BE')?

:= 'most-significant-first'

The order (most/least significant first) in which to pack or unpack octets

Result

xs:base64Binary

Namespace

http://expath.org/ns/binary

Links to specifications

EXPath Binary Module 1.0

EXPath Binary Module 4.0

Saxon availability

Available in XPath 2.0 and later versions. Implemented since Saxon 9.6. Requires Saxon-PE or Saxon-EE. Available for all platforms.