[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Maximum number of cells
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|