[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

using preceding-sibling to display subtotal row

Subject: using preceding-sibling to display subtotal row
From: dmitrik@xxxxxxxxxxxxxx
Date: Fri, 7 Jan 2005 10:14:40 -0500 (GMT-05:00)
xsl subtotal
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>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.