This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: fixed width output (was untitled)


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]