[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
<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
|
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
|