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" />?
</xsl:call-template>

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.

Implementations

The following XSLT processors support str:padding:

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

Examples

Function

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

Source

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

Stylesheet

<xsl:template match="a">
   <xsl:apply-templates />
</xsl:template>
<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="*" />
</xsl:template>

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