title: how can I sum by a group in xpath
body: <p>I have the following xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;football xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="football originalfootball.xsd"&gt;
      &lt;teams&gt;
          &lt;team&gt;
              &lt;name&gt;Jets&lt;/name&gt;
              &lt;city&gt;New York&lt;/city&gt;
              &lt;stadium&gt;Giants Stadium&lt;/stadium&gt;
          &lt;/team&gt;
          &lt;team&gt;
              &lt;name&gt;Giants&lt;/name&gt;
              &lt;city&gt;New York&lt;/city&gt;
              &lt;stadium&gt;Giants Stadium&lt;/stadium&gt;
          &lt;/team&gt;
          &lt;team&gt;
              &lt;name&gt;Bills&lt;/name&gt;
              &lt;city&gt;Buffalo&lt;/city&gt;
              &lt;stadium&gt;Wilson Stadium&lt;/stadium&gt;
          &lt;/team&gt;
      &lt;/teams&gt;
      &lt;scores&gt;
          &lt;score&gt;
              &lt;home&gt;
                  &lt;competitor&gt;Jets&lt;/competitor&gt;
                  &lt;points&gt;20&lt;/points&gt;
              &lt;/home&gt;
              &lt;visitor&gt;
                  &lt;competitor&gt;Giants&lt;/competitor&gt;
                  &lt;points&gt;7&lt;/points&gt;
              &lt;/visitor&gt;
          &lt;/score&gt;
          &lt;score&gt;
              &lt;home&gt;
                  &lt;competitor&gt;Bills&lt;/competitor&gt;
                  &lt;points&gt;10&lt;/points&gt;
              &lt;/home&gt;
              &lt;visitor&gt;
                  &lt;competitor&gt;Jets&lt;/competitor&gt;
                  &lt;points&gt;17&lt;/points&gt;
              &lt;/visitor&gt;
          &lt;/score&gt;
      &lt;/scores&gt;
  &lt;/football&gt;
  </code></pre>
  
  <p>I want to get the sum of points for each team.</p>
  
  <p>I've tried with <code>sum(//competitor[.=//name]/../points)</code> but it did not work.</p>
  
  <p>I want the teams that have beaten the Giants.</p>
  
  <p>Any ideas about this query?</p>