[xsl] Finding maximum among numbers

Subject: [xsl] Finding maximum among numbers
From: laksh vr <vrlaksh@xxxxxxxxx>
Date: Thu, 11 Apr 2002 03:38:31 -0700 (PDT)
Hai,
I'm in a process of finding the maximum no. of <td>
elements of the <tr> elements in a <table> element.By
finding this number i'm creating a new attribute
called "columns" for the table element.
i.e
  <table>
      <tr>
      <td>data1</td> 
      <td>data1</td> 
      <td>data1</td> 
      <td>data1</td> 
      </tr>
     
      <tr>
      <td>data2</td>
      <td>data1</td> 
      </tr>

      <tr>
      <td>data1</td> 
      </tr>

  </table>
**************************************
I was able to find 
1.The total no. of <td> elements using 
   <xsl:value-of select="count(./tr/td)"/> 
2.no. of <td> in each <tr> by
   <xsl:value-of select="count(./tr[position()]/td)"/>
3.no. of <td> in the last <tr> using
   <xsl:value-of select="count(./tr[last()]/td)"/>

But i'm searching for a way to find the maximun no. of
<td> elements of the <tr> elements in a table.
I've tried "for-each" technique

     <xsl:for-each select="./tr">
	<xsl:value-of select="count(./td)"/>
     </xsl:for-each>
but it gives me some big number(like 421,the no. of
<td>'s in 1st,2nd and 3rd <tr> is 4,2,1).The result i
want is the number 4 be assigned to the "columns"
attribute.

How can i fetch the maximum of these numbers?

Laksh.
 

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread