sum of previous nodes as value of current node in XSLT
<p>I am trying to obtain the target xml such that value of a node is comma seperated values of sum of previous similar node values. For e.g:</p>

<p>Input:</p>

<pre><code>&lt;Items&gt;
  &lt;Item&gt;
    &lt;name&gt;Drakshi&lt;/name&gt;
    &lt;price&gt;50&lt;/price&gt;
  &lt;/Item&gt;
  &lt;Item&gt;
    &lt;name&gt;Godambi&lt;/name&gt;
    &lt;price&gt;30&lt;/price&gt;
  &lt;/Item&gt;
  &lt;Item&gt;
    &lt;name&gt;Badami&lt;/name&gt;
    &lt;price&gt;70&lt;/price&gt;
  &lt;/Item&gt;
&lt;/Items&gt;
</code></pre>

<p>Output:</p>

<pre><code>&lt;result&gt;
 50,80,150
&lt;/result&gt;
</code></pre>

<p>As you can see above it is 50, (50+30), (50+30+70)</p>

<p>I tried with for-each Item and was able to find the sum of only current node and previous selected node. Can you please guide me here</p>