[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: "sum" of "substring"
Subject: Re: "sum" of "substring"
From: Larry Kollar <kollar@xxxxxxxxxx>
Date: Sat, 25 Oct 2003 20:20:15 -0400
|
Colin Simpson wrote:
My problem:
I have a flat text file that has to be transformed into a
predetermined XML
file.
Example:
TYPE1Field1AnotherField12.00YetAnotherField445.26FinalField
TYPE1ABCDEFABCDEFGHIJKL45.00ABCDEFGHIJKLMNO123.45ABCDEFGHIJ
TYPE2FieldAnother987.65Final
where the first 5 characters indicate which one of two record layouts
it is.
...
I need to total up certain numeric values within the record of a
specific
layouts.
For example, I want to total up the values that occupy positions 24
thru 28
from all records of "TYPE1".
MHO, this is really the realm of a flat-text processing program
like awk or perl. You have a wonderful XSLT hammer, but
you're trying to use it on a screw. Use awk to grind the threads
off the screw & make it into a nail that you can pound on with
XSLT. :-)
(I would post an entire awk script but it would be off-topic.)
I need to total up certain numeric values within the record of a
specific
layouts.
For example, I want to total up the values that occupy positions 24
thru 28
from all records of "TYPE1".
Is there any way of doing this?
An awk script could handle that too. You could create a <total>
element containing the sum at the end.
--
Larry Kollar k o l l a r @ a l l t e l . n e t
"The hardest part of all this is the part that requires thinking."
-- Paul Tyson, on xml-doc
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|