xsl-list
[Top] [All Lists]

Anything wrong in grouping/counting?

2005-05-26 02:32:06
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[(_at_)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()[(_at_)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 

--~------------------------------------------------------------------
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>
  • Anything wrong in grouping/counting?, Ranjan K. Baisak <=