Subject: Re: [xsl] Maximum number of cells From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 20 Dec 2000 17:17:13 +0000 |
<xsl:template match="/"> <xsl:call-template name="mostCells"/> </xsl:template>
<xsl:template name="mostCells"> <xsl:param name="rowsToGo" select="//rows"/> <xsl:param name="mostCellsSoFar" select="0"/> <xsl:if test="rowsToGo"> <xsl:call-template name="mostCells"> <xsl:with-param name="rowsToGo" select="$rowsToGo[position() > 1]"/> <xsl:with-param name="mostCellsSoFar"> <xsl:choose> <xsl:when test="count(cell) > $mostCellsSoFar"> <xsl:value-of select="count(cell)"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$mostCellsSoFar"/> </xsl:otherwise> </xsl:choose> </xsl:with-param> </xsl:call-template> </xsl:if> <xsl:value-of select="$mostCellsSoFar"/> </xsl:template>
Hello,
Given the following XML:
<table> <row> <cell>...</cell> </row> <row> <cell>...</cell> <cell>...</cell> <cell>...</cell> </row> <row> <cell>...</cell> <cell>...</cell> </row> </table>
I need to compare the number of cells in each row element and get the count of cell elements in the row that has the most (3 in this case). Does anyone have any ideas? Any help would be greatly appreciated.
Mark Dudley Xerox Corp. mark.dudley@xxxxxxxxxxxxx
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XSLT FAQ, Update, Dave Pawson | Thread | Re: [xsl] Maximum number of cells, Steve Muench |
Re: [xsl] Not able to work further , Mike Brown | Date | [xsl] NEWBIE: Instant Saxon and Uni, Graham Diehl |
Month |