[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Maximum number of cells
Subject: Re: [xsl] Maximum number of cells From: Miloslav Nic <nicmila@xxxxxxxxx> Date: Wed, 20 Dec 2000 23:39:05 +0100 |
XML: <table> <tr><td/><td/><td/></tr> <tr><td/><td/><td/><td/><td/><td/><td/></tr> <tr><td/><td/><td/><td/></tr> <tr><td/><td/></tr> <tr><td/></tr> <tr><td/><td/><td/></tr> </table> XSLT: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="tr"> <xsl:value-of select="count(td)"/> <xsl:text>~</xsl:text> </xsl:template> <xsl:template match="table"> <xsl:variable name="xxx"> <xsl:apply-templates select="tr"> <xsl:sort data-type="number" order="descending" select="count(td)" /> </xsl:apply-templates> </xsl:variable> <xsl:value-of select="substring-before($xxx,'~')"/> </xsl:template> </xsl:stylesheet> "Dudley, Mark" wrote: > > 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 -- ****************************************** <firstName> Miloslav </firstName> <surname> Nic </surname> <mail> nicmila@xxxxxxxxx </mail> <support> http://www.zvon.org </support> <zvonMailingList> http://www.zvon.org/index.php?nav_id=4 </zvonMailingList> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Maximum number of cells, Goetz Bock | Thread | RE: [xsl] Maximum number of cells, Dudley, Mark |
[xsl] parent node/ child node, James Piva | Date | RE: [xsl] strangeness with <xsl:var, Mike Hostetler |
Month |