Is there any standard template in XSLT 1.0 available which does justification and pad the field to max length?
Is there any standard template in XSLT 1.0 available which does justification and pad
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Unfortunately XSLT does not comes with the padding function, the good part is that is very simple to do so as pointed by this blog post: http://www.dpawson.co.uk/xsl/sect2/padding.html
(Web archive version: http://web.archive.org/web/20171225234313/http://www.dpawson.co.uk/xsl/sect2/padding.html )
For example if you want to right pad a 10 spaces string you can do:
if you need a left pad you can change the order of the concat parameters as following:
Notice that the string with spaces should contain the same amount of chars as your padding is needing, so if you want a 10 pad, you will need a 10 spaces string.