EXSLT - str:padding

Implementer Page: str.padding.html
Function Package: str.padding.zip

Function Syntax

string str:padding(number, string?)

Template Syntax

<xsl:call-template name="str:padding">
   <xsl:with-param name="length" select="number" />
   <xsl:with-param name="chars" select="string" />?

The str:padding function creates a padding string of a certain length.

The first argument gives the length of the padding string to be created.

The second argument gives a string to be used to create the padding. This string is repeated as many times as is necessary to create a string of the length specified by the first argument; if the string is more than a character long, it may have to be truncated to produce the required length. If no second argument is specified, it defaults to a space (' '). If the second argument is an empty string, str:padding returns an empty string.


The following XSLT processors support str:padding:

Implementations of str:padding are available in the following languages:



The following example shows how to use the str:padding function:


   <c>Is this EXSLT? No. no</c>


<xsl:template match="a">
   <xsl:apply-templates />
<xsl:template match="*">
   <xsl:value-of select="str:padding(20, '---4567----23----890----------')" />
   <xsl:value-of select="." />
   <xsl:value-of select="str:padding(10, '+-+')" />
   <xsl:apply-templates select="*" />

http://www.exslt.org/str/functions/padding/index.html last modified 2002-11-12