{"id":6632,"date":"2016-07-18T19:09:51","date_gmt":"2016-07-18T17:09:51","guid":{"rendered":"http:\/\/www.b.shuttle.de\/hayek\/hayek\/jochen\/wp\/blog-en\/?p=6632"},"modified":"2016-07-18T19:09:51","modified_gmt":"2016-07-18T17:09:51","slug":"xpath-and-xquery-functions-and-operators-3-0-formatting-integers-and-numbers","status":"publish","type":"post","link":"https:\/\/wp.jochen.hayek.name\/blog-en\/2016\/07\/18\/xpath-and-xquery-functions-and-operators-3-0-formatting-integers-and-numbers\/","title":{"rendered":"XPath and XQuery Functions and Operators 3.0: Formatting integers and numbers"},"content":{"rendered":"<ul>\n<li><a href=\"https:\/\/www.w3.org\/TR\/xpath-functions-30\">https:\/\/www.w3.org\/TR\/xpath-functions-30<\/a><\/li>\n<li><a href=\"https:\/\/www.w3.org\/TR\/xpath-functions-30\/#formatting-integers\">https:\/\/www.w3.org\/TR\/xpath-functions-30\/#formatting-integers<\/a><\/li>\n<li><a href=\"https:\/\/www.w3.org\/TR\/xpath-functions-30\/#formatting-the-number\">https:\/\/www.w3.org\/TR\/xpath-functions-30\/#formatting-the-number<\/a><\/li>\n<li><a href=\"http:\/\/www.xqueryfunctions.com\/xq\/functx_pad-integer-to-length.html\">http:\/\/www.xqueryfunctions.com\/xq\/functx_pad-integer-to-length.html<\/a><\/li>\n<li><a href=\"http:\/\/www.xqueryfunctions.com\/xq\/functx_pad-string-to-length.html\">http:\/\/www.xqueryfunctions.com\/xq\/functx_pad-string-to-length.html<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/JochenHayek\/misc\/blob\/master\/xqueryfunctions\">https:\/\/github.com\/JochenHayek\/misc\/blob\/master\/xqueryfunctions<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/JochenHayek\/misc\/blob\/master\/xqueryfunctions\/pad-string-to-length-on-the-left.xqy\">https:\/\/github.com\/JochenHayek\/misc\/blob\/master\/xqueryfunctions\/pad-string-to-length-on-the-left.xqy<\/a><\/li>\n<\/ul>\n<p>I need to pad a decimal number to a given length with leading white space. Looks like there is nothing in the &#8220;built-in library&#8221;. Looks like there is no\u00a0functx:pad-integer-to-length as well, but\u00a0functx:pad-string-to-length\u00a0looks intriguing \u2013 but it only pads on the right. I created a variant, that pads on the left:\u00a0<code>pad-string-to-length-on-the-left.xqy<\/code> \u2013 pls follow the link shown above!\t\t\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/www.w3.org\/TR\/xpath-functions-30 https:\/\/www.w3.org\/TR\/xpath-functions-30\/#formatting-integers https:\/\/www.w3.org\/TR\/xpath-functions-30\/#formatting-the-number http:\/\/www.xqueryfunctions.com\/xq\/functx_pad-integer-to-length.html http:\/\/www.xqueryfunctions.com\/xq\/functx_pad-string-to-length.html https:\/\/github.com\/JochenHayek\/misc\/blob\/master\/xqueryfunctions https:\/\/github.com\/JochenHayek\/misc\/blob\/master\/xqueryfunctions\/pad-string-to-length-on-the-left.xqy I need to pad a decimal number to a given length with leading white space. Looks like there is nothing in the &#8220;built-in library&#8221;. Looks like there is no\u00a0functx:pad-integer-to-length as well, but\u00a0functx:pad-string-to-length\u00a0looks intriguing \u2013 but it only pads on the right. I created a variant, that pads on [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_share_on_mastodon":"0"},"categories":[666,732,733],"tags":[],"class_list":["post-6632","post","type-post","status-publish","format-standard","hentry","category-uncategorized","category-xpath","category-xquery"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paO0kP-1IY","jetpack_likes_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/6632","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/comments?post=6632"}],"version-history":[{"count":0,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/6632\/revisions"}],"wp:attachment":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/media?parent=6632"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/categories?post=6632"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/tags?post=6632"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}