Sunday, March 15, 2015

Padding 0's in XSLT

I want a string to be fixed to 10 digits and pad 0's if it is less than length 10. This I have to achieve in XSLT here is how we can do it,

substring(concat("0000000000",string(//b/text())),string-length(//b/text())+1)

Assuming //b will have the string which is to be formatted.

Where as the same can be achieved using String functions in java,

String.format("%010d", 1236)




No comments:

Post a Comment