[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Using xslt how can i find out a <tr> with greate3r

Subject: Re: Using xslt how can i find out a <tr> with greate3r number of td/th?
From: "cking" <cking@xxxxxxxxxx>
Date: Fri, 17 Sep 2004 18:50:26 +0200
xsl max count
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

 <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>
 <xsl:strip-space elements="*"/>

 <xsl:template match="/*">
  <result>
   <xsl:apply-templates/>
  </result>
 </xsl:template>

 <xsl:template match="tr">
  <xsl:variable name="n" select="count(th|td)"/>
  <xsl:if test="not(../tr[count(th|td) > $n])">
   <max count="{$n}" index="{count(preceding-sibling::tr)+1}"/>
  </xsl:if>
 </xsl:template>

</xsl:stylesheet>

--- output:
,
<result>
   <max count="4" index="2"/>
</result>

(if there are more than 1 tr with max nr of th|td in the input, 
there will be more than 1 max in result output, too)

Cheers,
Anton Triest


Eldho George wrote:
> 
> Hai all
>  
> Using xslt how can i find out a <tr> with greate3r number of td/th? is it
> possible?
>  
> <tr>
> <td></td>
> <tr>
> <tr>
> <td></td>
> <td></td>
> <td></td>
> <td></td>
> </tr>
>  
> Here I want tr[2].Each time the structure is different.I want to take the
> <tr> with maximum number of <td>|<th>
>  
> Please help me
> Thanks in advance

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.