xsl-list
[Top] [All Lists]

[xsl] convert xml to fixed length format

2013-09-19 10:14:41
Hello:

Is it possible to convert an xml file into a fixed length format?

For example, if I have an xml file as follows:
<products>
<product>
<id>12345</id>
<type>Toy</type>
<description> This is a soft toy</description>
</product>
<product>
<id>6789</id>
<type>Car</type>
<description> This is a car</description>
</product>
</products>

Now, I want to convert this into a fixed length format based on
specific string lengths. So if I defined id to be a fixed length of
10, type to be a fixed length of 25, and description to be a fixed
length of 50, I want a text file with these values, and the rest of
the spaces must be filled in such a way so as to meet the length
criteria. That means, if id was only 5 digits long, there should be
spaces for another 5 characters that total to 10, and the value for
type must start on the 11th digit.

Is this possible with XSLT?

Any help is appreciated.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>