RE: [xsl] Calculating cumulative values - Abel's solution

Subject: RE: [xsl] Calculating cumulative values - Abel's solution
From: "Simon Shutter" <simon@xxxxxxxxxxx>
Date: Fri, 31 Aug 2007 11:14:57 -0700
Abel,

One day I'll understand the lingo!  What I meant was that I was hoping the
output would be identical to the input except for the addition of the new
cumulative attributes y2 and y3.  Is this called an "identity
transformation"?

Thanks, Simon


Here's my desired output:

<g id="theroot" xmlns:myns="http://www.acme.com/myns";>
  <g id="groupA">
    <svg x="10" y="10" width="1000" height="1000" viewBox="0 0 1000 1000">
      <g transform="scale(1,1)">
        <rect x="1" myns:y1="2" width="100" height="100" fill="red" y2="2"
y3="2"/>
        <rect x="1" myns:y1="3" width="100" height="100" fill="red" y2="5"
y3="5"/>
        <rect x="1" myns:y1="0" width="100" height="100" fill="red" y2="5"
y3="5"/>
        <rect x="1" myns:y1="2" width="100" height="100" fill="red" y2="7"
y3="7"/>
        <rect x="1" myns:y1="2" width="100" height="100" fill="red" y2="9"
y3="9"/>
        <rect x="2" myns:y1="3" width="100" height="100" fill="red" y2="3"
y3="3"/>
        <rect x="2" myns:y1="0" width="100" height="100" fill="red" y2="3"
y3="3"/>
        <rect x="2" myns:y1="2" width="100" height="100" fill="red" y2="5"
y3="5"/>
        <rect x="3" myns:y1="2" width="100" height="100" fill="red" y2="2"
y3="2"/>
        <rect x="3" myns:y1="3" width="100" height="100" fill="red" y2="5"
y3="5"/>
        <rect x="3" myns:y1="1" width="100" height="100" fill="red" y2="6"
y3="6"/>
        <rect x="3" myns:y1="2" width="100" height="100" fill="red" y2="8"
y3="8"/>
        <rect x="3" myns:y1="2" width="100" height="100" fill="red" y2="10"
y3="10"/>
      </g>
    </svg>
  </g>
  <g id="groupB">
    <svg x="10" y="1010" width="1000" height="1000" viewBox="0 0 1000 1000">
      <g transform="scale(1,1)">
        <rect x="1" myns:y1="2" width="100" height="100" fill="red" y2="2"
y3="11"/>
        <rect x="1" myns:y1="3" width="100" height="100" fill="red" y2="5"
y3="14"/>
        <rect x="1" myns:y1="0" width="100" height="100" fill="red" y2="5"
y3="14"/>
        <rect x="1" myns:y1="2" width="100" height="100" fill="red" y2="7"
y3="16"/>
        <rect x="2" myns:y1="2" width="100" height="100" fill="red" y2="2"
y3="7"/>
        <rect x="3" myns:y1="2" width="100" height="100" fill="red" y2="2"
y3="12"/>
        <rect x="3" myns:y1="2" width="100" height="100" fill="red" y2="4"
y3="14"/>
        <rect x="3" myns:y1="2" width="100" height="100" fill="red" y2="6"
y3="16"/>
      </g>
    </svg>
  </g>
  <g id="groupC">
    <svg x="10" y="2010" width="1000" height="1000" viewBox="0 0 1000 1000">
      <g transform="scale(1,1)">
        <rect x="1" myns:y1="2" width="100" height="100" fill="red" y2="2"
y3="18"/>
        <rect x="1" myns:y1="3" width="100" height="100" fill="red" y2="5"
y3="21"/>
        <rect x="1" myns:y1="2" width="100" height="100" fill="red" y2="7"
y3="23"/>
        <rect x="2" myns:y1="3" width="100" height="100" fill="red" y2="3"
y3="10"/>
        <rect x="2" myns:y1="0" width="100" height="100" fill="red" y2="3"
y3="10"/>
        <rect x="2" myns:y1="2" width="100" height="100" fill="red" y2="5"
y3="12"/>
        <rect x="3" myns:y1="3" width="100" height="100" fill="red" y2="3"
y3="19"/>
      </g>
    </svg>
  </g>
</g>

-----Original Message-----
From: Abel Braaksma [mailto:abel.online@xxxxxxxxx] 
Sent: August 31, 2007 10:40 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Calculating cumulative values - Abel's solution

Simon Shutter wrote:
>
> The question I have now is how to replicate the top three levels in 
> the hierarchy to the output.  Do I have to change the pattern match on 
> the root node?
>
> <snip />
>
> And here's what I am outputting:
>
> <snip />
>   


I would like to help, but unfortunately, I don't understand your question.
What do you mean with "replicate the top three level in the hierarchy to the
output"? Levels of what? Can you post an example of what output you expect?
(you only posted the current output, but comparing it to what you expect
would help the aha-erlebnis ;)

Cheers,
-- Abel Braaksma

PS: I'm glad you got it working. ;)

Current Thread