# EXSLT - str:padding - Implementer Page

Version: 1 Status: new User Page: index.html XML Definition: str.padding.xml 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.

An implementation of this extension function in the EXSLT str namespace must conform to the behaviour described in this document.

## Implementations

Built-in support for `str:padding` is available in the following XSLT processors:

Processor | Processor Version | Implemented Version
--- | --- | ---
4XSLT, from 4Suite. | 0.12.0a3 | 1
libxslt from Daniel Veillard et al. | 1.0.19 | 1

The following implementations of `str:padding` are available:

Language | Implemented Version | Creator | Date | Download
--- | --- | --- | --- | ---
EXSLT Function | 1 | Jeni Tennison | 2001-07-18 | str.padding.function.xsl
XSLT Template | 1 | Jeni Tennison | 2001-07-18 | str.padding.template.xsl
Javascript | 1 | Chris Bayes | 2001-06-21 | str.padding.js
Msxsl | 1 | Chris Bayes | 2001-06-21 | str.padding.msxsl.xsl

## Use Cases

Use Case Package: str.padding.use-cases.zip

The following use cases illustrate the functionality of `str:padding`.

Details | Calling Stylesheet | XML Data | Expected Result | Category | Template
--- | --- | --- | --- | --- | ---
1 | str.padding.1.xsl | str.padding.data.1.xml | - | example | N

## Change History

Submitted: 2001-06-08
Creator: Jeni Tennison(http://www.jenitennison.com/)

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

Version | Modified | By | Details
--- | --- | --- | ---
1.1 | 2001-06-21 | Jeni Tennison | Added Javascript and MSXML implementations.
1.2 | 2001-11-18 | Jeni Tennison | Added description of what to do if the second argument is an empty string; str:padding() should return an empty string.
1.3 | 2002-08-21 | Craig Stewart | Added 4XSLT and libxslt implementation to the list.
1.4 | 2002-11-12 | Craig Stewart | Updated 4XSLT version to 0.12.0a3.

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