XQuery: padding an integer or a number, but not with “0”

I found this function, but it pads on the right:

I derived pad-string-to-length-on-the-left from it:

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 )

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.