I found this function, but it pads on the right:
- http://www.xqueryfunctions.com/xq/functx_pad-string-to-length.html : functx:pad-string-to-length
I derived pad-string-to-length-on-the-left
from it:
- https://github.com/JochenHayek/misc/blob/master/xqueryfunctions/pad-string-to-length-on-the-left.xqy
- https://github.com/JochenHayek/misc/blob/master/xqueryfunctions
I use it around format-integer and format-number, e.g.
let $net_amount_formatted := local:pad-string-to-length-on-the-left( format-number( data($invoice/@net_amount) , '#,###.#####' ) , ' ' , 12 )
Leave a Reply