xsl-list
[Top] [All Lists]

[xsl] [xsl 2.0] counting the nodes in the current group

2008-05-28 14:02:14
I'm getting up to speed on XSL. Michael Kay's XSL 2.0 and XPath 2.0 Programmer's Reference has been invaluable. I've got my first XSL transform working, but there is one last detail I can't seem to work out.

In the example below, Instead of a "5" in the 'aid:trows="5"' statement in line 10, I need to insert the actual number of occurances of "man_part_no" in the current group. I've been trying some things with the count() function, but can't seem to get it right. I know that count will return the number of items in a sequence, so I assume I'm close to the solution, but I'm stuck. Any help pointing me in the right direction would be appreciated.

01. <!-- group by category -->
02. <xsl:for-each-group select="//Item" group-adjacent="category">
03.      <!-- sub-group by type -->
04. <xsl:for-each-group select="current-group()" group- adjacent="type">
05.          <!-- test to see if the type is blank or not -->
06.          <xsl:choose>
07.               <xsl:when test="string(current-grouping-key())">
08.                    <!-- type is not blank -->
09.                    <Paragraph aid:pstyle="Table">
10. <Table aid:table="table" aid5:tablestyle="IC table 1" aid:trows="5" aid:tcols="7">
11.                          <xsl:for-each select="current-group()">
12. <Cell aid:table="cell" aid:crows="1" aid:ccols="1"><xsl:value-of select="man_part_no"/></Cell>
13.                          </xsl:for-each>
14.                     </Table>
15.                     </Paragraph>
16.               </xsl:when>
17.          </xsl:choose>
18.     </xsl:for-each-group>
19. </xsl:for-each-group>



~ Keith




--~------------------------------------------------------------------
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>