[xsl] RE: fixed width output (was untitled)

Subject: [xsl] RE: fixed width output (was untitled)
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Wed, 28 Mar 2001 10:52:37 +0100
> Is it possible to define the Alignment of a Text/Number in XSLT ?
>
>
> If I want the output method as TEXT. How to define the XSL so
> that the ouput result as following ?
>
> 123456789012345678901234567890
> ---------|---------|---------|-----------
> Pen 1.25
> Pencil 0.50
> Bag 12.38
> ---------|---------|---------|-----------
> 123456789012345678901234567890
>
>
You can pad a string to a fixed length using:

<xsl:variable name="spaces" select="'
'"/>

then
select="substring(concat($value, $spaces), $width))"

You can output a number in fixed width using the format-number() function.

Mike Kay
Software AG


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread