[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Sum of multiple elements

Subject: Sum of multiple elements
From: "Chad Gorshing" <gorshing@xxxxxxxxx>
Date: Fri, 29 Jun 2007 15:47:59 -0500
 Sum of multiple elements
I have an instance document, input.xml below, that I have to perform a
sum on multiple elements.  As you can see in my instance document, I
perform the sum function with the 'count' element.  I believe this is
going to mainly be a grouping problem.

I need to sum all of:
* Sex, Grade, Race - (All males, in grade 01, of race HI)
* Sex, Grade - (All males in grade 01)
* Sex, Race - (All males of race HI)
* Grade, Race - (Everybody of race HI in grade 01)

These totals are repeated for about 15 grades, and 6 races, and of
course once for male and another time for females.  So 15 * 6 = 90 ...
90 * 2 = 180 combinations.  You can see where my concern lies.

But these sums need to be group within their 'local' parent element.

My instance document can be as large as (or possibly even larger than)
20MB.  So with a document that big and with all the combinations ...
well ... I'm just plain scared :)

I would like to open the door for suggestions on the best way to
handle this.  I would assume this is best left up to something such as
a DBMS, but I am currently stuck with this scenario.  I do also have
access to the schema, so reading the possible values from a schema is
also an option instead of traversing the document.

The project will be a C# 2.0 app, but for testing and developing of
the transform I am using xalan 1.10.0 with xerces 2.7.0 ... so no XSLT
2.0 possible.


<?xml version="1.0" ?>
<data xmlns="http://schemas.somewhere.com/class.xsd">
<district num="1234">
  <local num="1234-12">
  <local num="1234-12">

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.