[xsl] Sum with generate-id, Is it right ?

Subject: [xsl] Sum with generate-id, Is it right ?
From: Marcos Hercules Sant <mhercules@xxxxxxxxx>
Date: Sun, 23 Jan 2005 16:33:22 -0200
Hi, I'm trying hard to work with sum, and I don't know what could be
happening to it goes wrong , I need to obtain a value  total by
grouping, but it gives me the units values one under another . Here
goes my XSL:


 <xsl:template match="/">

<html>

</html>

   <h2>Grouping disciplines by Titles(ISBN) </h2>

   <xsl:for-each select="$referencias">

     <xsl:sort select="sobrenome-autor" order="ascending" />

     <xsl:variable name="isbn" select="isbn" />

     <xsl:if test="generate-id(.)=generate-id($referencias[isbn=$isbn])">

<b><xsl:value-of select='sobrenome-autor'/></b>,&#160;<xsl:value-of
select='nome-autor'/>.&#160;<xsl:value-of
select='titulo'/>.&#160;<xsl:value-of
select='ano'/>.&#160;<xsl:value-of select="isbn" /><br/>

&#160;</h3>

<table width="95%">
       <tr>
           <th>CURSO</th>
           <th>DISCIPLINA</th>
           <th>CODIGO</th>
           <th>VAGAS</th>
          <th>EXEMPLAR</th>
           <th>NIVEL</th>
       </tr>

         <xsl:for-each select="$referencias[isbn=$isbn]">

     <xsl:sort select="../../../@name" order="ascending" />
     <xsl:sort select="../../descricao" order="ascending" />


<tr>
<ul>
<th><xsl:value-of select="../../../@name"/></th>
<th><xsl:value-of select="../../descricao"/></th>
<th><xsl:value-of select="../../@id"/></th>
<th><xsl:value-of select="../../vagas"/></th>

Total: <xsl:value-of select="sum(vagas)" />     <--Here is my problem
it doesn't display the total -->

</ul> <br/>
</tr>

</xsl:for-each>
</table>

</xsl:if><br/>

</xsl:for-each>

 </xsl:template>
</xsl:stylesheet>

Marcos Hercules

Current Thread