xsl-list
[Top] [All Lists]

using preceding-sibling to display subtotal row

2005-01-07 08:14:40
There are a list of elements, and the following code is trying to create a new 
row to display subtotals.
There might be any number of Customer rows. Is there a way to check if I've 
reached the last customer, and then
insert the subtotal row? The following code is inserting on every row, instead 
of the last.

Thanks,
Dmitri

<xsl:for-each select="../Trade[Customer = current()/Customer]">

<xsl:choose>
          
          <!-- <xsl:when test="preceding-sibling::Trade[1]/Customer = 
Customer">-->
          <xsl:when test="preceding-sibling::Trade[Customer = 
current()/Customer]/Customer = Customer">
        
                


           
           </xsl:when>
            <xsl:otherwise>
        
        <tr>
        
        <!--<td><b><xsl:value-of select="Customer"/></b></td>-->
        <td></td>
        <td></td>
        <td align="right"><b><xsl:value-of 
select="format-number(sum(../Trade[Customer = 
current()/Customer]/Step[concat(substring(MinFlowDate,7),substring(MinFlowDate,1,2),substring(MinFlowDate,4,2))&gt;=
        
concat(substring($global,7),substring($global,1,2),substring($global,4,2))]
           
[concat(substring(MinFlowDate,7),substring(MinFlowDate,1,2),substring(MinFlowDate,4,2))&lt;
        
concat(substring($global,7)+3,substring($global,1,2),substring($global,4,2))]/StepCharge)+sum(../Trade[Customer
 = 
current()/Customer]/Step[concat(substring(MinFlowDate,7),substring(MinFlowDate,1,2),substring(MinFlowDate,4,2))&gt;=
        
concat(substring($global,7),substring($global,1,2),substring($global,4,2))]
           
[concat(substring(MinFlowDate,7),substring(MinFlowDate,1,2),substring(MinFlowDate,4,2))&lt;
        
concat(substring($global,7)+3,substring($global,1,2),substring($global,4,2))]/StepSetoff),
 '###,###,###,##0')"/></b></td>
        
        </tr>   

            </xsl:otherwise>
            </xsl:choose>

</xsl:for-each>




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>