Advertisements

Friday, August 18, 2017

XSL left-right padding

Here is an example of howto accomplish padding situations:

For example if you want to right pad a 10 spaces string you can do:
<xsl:value-of 
 select="substring(concat($string, '          '), 1, 10))"/>

if you need a left pad you can change the order of the concat parameters as following:
<xsl:value-of 
 select="substring(concat('          ', $string), string-length($string)+1, 10))"/>

Now you can build a template function to call it.

No comments:

Post a Comment