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:

ProcessorProcessor VersionImplemented Version
4XSLT, from 4Suite.0.12.0a31
libxslt from Daniel Veillard et al.1.0.191

The following implementations of str:padding are available:

LanguageImplemented VersionCreatorDateDownload
EXSLT Function1Jeni Tennison2001-07-18str.padding.function.xsl
XSLT Template1Jeni Tennison2001-07-18str.padding.template.xsl
Javascript1Chris Bayes2001-06-21str.padding.js
Msxsl1Chris Bayes2001-06-21str.padding.msxsl.xsl

Use Cases

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

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

DetailsCalling StylesheetXML DataExpected ResultCategoryTemplate
1str.padding.1.xslstr.padding.data.1.xml-exampleN

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.
VersionModifiedByDetails
1.12001-06-21Jeni Tennison Added Javascript and MSXML implementations.
1.22001-11-18Jeni Tennison Added description of what to do if the second argument is an empty string; str:padding() should return an empty string.
1.32002-08-21Craig Stewart

Added 4XSLT and libxslt implementation to the list.

1.42002-11-12Craig Stewart

Updated 4XSLT version to 0.12.0a3.

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