[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Funky Summation
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
|
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
|