Subject: Funky Summation From: Nate Austin <naustin@xxxxxxxxxxxxxxx> Date: Fri, 15 Sep 2000 18:50:16 -0500 |
Greetings. I've thrashed around with a few ideas to no avail, so finally to here. Here's the problem: <record> <header> <name>ralph</name> <dest_acct_no>2222222</dest_acct_no> </header> <detail> <name>george</name> <acct_no>123456789</acct_no> </detail <detail> <name>bob</name> <acct_no>987654321</acct_no> </detail> </record> I have a large number of records in similar fashion to this There is one header record and many detail records. I need to compute a checksum of the account numbers that is as follows: If the number is less than 11 digits, pad it on the right with zeros. (ie. 12345678900). Take the first 6 digits minus the 2nd 6 digits. Do this for the header record and the detail records. The checksum for each detail record is computed by taking the absolute value of the value of the header record minus the value of the detail record. Add each detail record's checksum to come up with a total checksum. The example here would be: abs((222222 - 20000) - (123456 - 78900)) + abs((222222 - 20000) - (987654 - 32100)) + ... = 157666 + 753332 = 910998. I looked into using sum() to come up with this and a for-each. I couldn't work it through to the end either way. If anyone could help it'd be much appreciated! Nate Austin naustin@xxxxxxxxxxxxxxx Phone: (612) 277-2523 The opinions expressed are my own and do not reflect those of Decision Systems, Inc. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Article on using XSLT for Validatio, uche . ogbuji | Thread | Re: Funky Summation, Alexey Gokhberg |
Article on using XSLT for Validatio, uche . ogbuji | Date | Re: XSLT V 1.1, Paul Tchistopolskii |
Month |