pad-string
Prev | Common » Utility Template Reference | Next

## pad-string

pad-string — Right-pads or left-pads a string out to a certain length

## Synopsis

    <xsl:template name="pad-string">
    <xsl:param name="padChar" select="' '"/>
    <xsl:param name="leftRight">left</xsl:param>
    <xsl:param name="padVar"/>
    <xsl:param name="length"/>
      ...
    </xsl:template>

## Description

This function takes string `padVar` and pads it out in the direction `rightLeft` to the string-length `length`, using string `padChar` (a space character by default) as the padding string (note that `padChar` can be a string; it is not limited to just being a single character).

### Note

This function began as a copy of Nate Austin's `prepend-pad` function in the Padding Content section of Dave Pawson's XSLT FAQ.

## Returns

Returns a (padded) string.

Prev | Up | Next
get.doc.title | Home | Common » Character-Map Template Reference