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

Anything wrong in grouping/counting?

Subject: Anything wrong in grouping/counting?
From: "Ranjan K. Baisak" <ranjanbaisak@xxxxxxxxx>
Date: Thu, 26 May 2005 02:32:06 -0700 (PDT)
exslt trim
I have following script for grouping and
counting.Apology for big chunk of code. Why count is
always count+1 for first row? Am I doing something
wrong?
-----------------------
<xsl:variable name="partlist">
		<xsl:for-each
select="//A[property/@name='PartNumber']">
			<xsl:copy>
				<xsl:copy-of
select="property[@name='PartNumber']/@val"/>
			</xsl:copy>
		</xsl:for-each>
	</xsl:variable>
	<!--Sort PartNumber by @val  -->
		<xsl:variable name="OrderedParts">
			<xsl:for-each select="exslt:node-set($partlist)/*">
				<xsl:sort select="@val"/>
				<xsl:copy-of select="."/>
			</xsl:for-each>
		</xsl:variable>
	<xsl:for-each
select="exslt:node-set($OrderedParts)/*">
		<xsl:variable name="current" select="@val"/>
		<xsl:if test="string(@val) != string(
following-sibling::node()[1]/@val)">
			<xsl:variable name="count"
select="count(preceding-sibling::node()[@val =
$current])+1"/>
			<xsl:variable name="partnumber" select="@val"/>
			<xsl:call-template name="colorTemplate"/>
		
			<td>
				<xsl:value-of select="$count"/>
				
			</td>
		</xsl:if>
	</xsl:for-each>
-------------------
I would appreciate your help.
-Ranjan

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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.