1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Development XQuery problems

Discussion in 'Software' started by globe, 28 Jan 2006.

  1. globe

    globe What's a Dremel?

    Joined:
    19 Dec 2003
    Posts:
    40
    Likes Received:
    0
    i have a xml file like so:

    Code:
    <results group="A">
    <match>
    	<date>10-Jun-98</date>
    	<team score="2">Brazil</team>
    	<team score="1">Scotland</team>
    </match>
    <match>
    	<date>10-Jun-98</date>
    	<team score="2">Morocco</team>
    	<team score="2">Norway</team>
    </match>
    .......
    </results>
    and an unfinished xquery query like so:

    Code:
     <table>
     <tr>
      <td>team</td>
      <td>played</td>
      <td>won</td>
      <td>drawn</td>
      <td>lost</td>
      <td>for</td>
      <td>against</td>
     </tr>
    
    {
    
    for $team in distinct-values(doc("soccer.xml")/results/match/team)
    let $matches := doc("soccer.xml")/results/match[team = $team]
    
    return
      <tr>
       <td>{$team}</td>
       <td>{fn:count($matches)}</td>
       <td></td>
       <td></td>
       <td></td>
       <td></td>
       <td></td>
      </tr>
    
    }
    
     </table>
    the problem is getting the other values than the ones in it already

    like the goals done, i have no idea how to reference the actual scores and
    count them instead of counting the amount of results of scores

    { $results[team = $team][@score] } etc i've tried with no results at all
     

Share This Page