Subject: Re: [xsl] Finding the maximun number of nodes From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Fri, 5 Jan 2001 01:47:59 -0800 (PST) |
Here's the solution with variable number of tables -- you can parameterise it as an exercise... :o))) <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' > <xsl:key name="numCells" match="tr" use="count(td)"/> <xsl:template match="/"> <xsl:value-of select="count(//table[@ID='1']/tr[not(key('numCells', count(td) + 1)[parent::table[@ID='1']] )]/td)"/> </xsl:template> </xsl:stylesheet> Given the following input: <tables> <table ID="1"> <tr><td>(1,1)</td></tr> <tr><td>(2,1)</td><td>(2,2)</td><td>(2,3)</td></tr> <tr><td>(3,1)</td><td>(3,2)</td></tr> </table> <table ID="2"> <tr><td>(1,1)</td></tr> <tr><td>(2,1)</td><td>(2,2)</td><td>(2,3)</td></tr> <tr><td>(3,1)</td><td>(3,2)</td><td>(3,3)</td><td>(3,4)</td></tr> </table> </tables> it produces: 3 Cheers, Dimitre. Michael Lee wrote: Dimitre's solution makes use of <xsl:key>, something that I am not familiar with. However, I believe it still doesn't work if the stylesheet has to handle an unknown number of tables. Michael Lee __________________________________________________ Do You Yahoo!? Yahoo! Photos - Share your holiday photos online! http://photos.yahoo.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Finding the maximun numbe, Dimitre Novatchev | Thread | RE: [xsl] Finding the maximun numbe, Kay Michael |
[xsl] sorting, Krithiga Subramanian | Date | RE: [xsl] Re: current(), Kay Michael |
Month |