This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: text output and space padding
- To: xsl-list at lists dot mulberrytech dot com
- Subject: RE: [xsl] text output and space padding
- From: "Clapham, Paul" <pclapham at core-mark dot com>
- Date: Wed, 30 May 2001 09:13:42 -0700
- Reply-To: xsl-list at lists dot mulberrytech dot com
http://www.dpawson.co.uk/xsl/padding.html
-----Original Message-----
From: angie.tong@firstunion.com [mailto:angie.tong@firstunion.com]
Sent: May 30, 2001 08:34
To: XSL-List@lists.mulberrytech.com
Subject: [xsl] text output and space padding
I'm new to XML and XSL technologies so please give me a hand here. I have
been researching and reading references on XSL and couldn't find a way to
do this. I need to read an XML file and generate a flat file with fixed
length fields for mainframe. So that means I need to write data padded
with space if the data does not fill up to the required length. So
something like this:
COMPANY A COMPANY B 20000
will need to be generated from an XML file for example:
<policies>
<sender_info>COMPANY A</sender_info>
<carrier_info>COMPANY B</carrier_info>
<amount>200.00</amount>
</policies>
The trick here is that the trailing space after each field might be
different depending on the length of the data itself. I thought about
writing a "function" to output spaces depending on the parameter input.
But then I will need to do a for loop with index like in C:
for (i=0;i<30;i++)
which I know it cannot be done in XSL. Any ideas?
Angie
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list