Asked By Eric
30-Jan-10 05:41 PM

How do I use XSL to calculate a value relative to other values?
I start with XML fields that look something like this:
Then I start on processing at the A level and process each lower item
recursively:
()" />
$total_amount) * 100,'##0.00')" />
Now, on each I have the amount, and the total for all B, and the
percentage of the total, and the position.
This is the simple version, hopefully enough to figure out what I am
doing. There is a lot more code in this stylesheet. Now, I am using
these values to build a pie. I have the calculated values to draw the
pie, with the start and end points of each percentage around the edge
of the pie. First, if I take the midpoint of each pie piece, I want
to know which quadrant it is in (0-25%,25-50%,50-75%,75-100%). Then
the tricky part. I want to know how many midpoints of other pie
pieces fall before and after the current pie piece in that quadrant
(if quadrant 1 or 3 get count of pieces in quadrant 3 with lower
percentage, if quadrant 2 or 4 get count of pieces in quadrant 2 or 4
with higher percentage).