This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
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@usa.xerox.com
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
--
******************************************
<firstName> Miloslav </firstName>
<surname> Nic </surname>
<mail> nicmila@idoox.com </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