This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: fixed width output (was untitled)
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] RE: fixed width output (was untitled)
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Wed, 28 Mar 2001 10:52:37 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
> 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