i have the following table and with to extract the names of the cars and the description, but i am having real trouble. can anyone help me along TIA ElTigro_UK <table cellpadding="1" cellspacing="1"> <tr> <td colspan="3" align="left"><b class="new">Car List</b></td> </tr> <tr> <td valign="top"><a href="/Name?Testarossa,%20Ferrari">Ferrari Testarossa</a></td> <td valign="top" nowrap="1">....</td> <td valign="top">Fast Italian Sportscar</td> </tr> <tr> <td valign="top"><a href="/Name?Boxster,%20Porsche">Porsche Boxster</a></td> <td valign="top" nowrap="1">....</td> <td valign="top">Fast German Sportscar</td> </tr> </table>
Your name isn't even close to the JavaRanch Naming Policy. Your name should be two words, firstname then lastname with a space in the middle. This naming policy is enforced to promote a professional atmosphere in the forums. Note: I once used a name like yours and I have since changed it. My post can be seen here: My First Name Experience You can change your display name here: http://www.coderanch.com/forums/user/edit Eric [ April 01, 2003: Message edited by: Eric Pascarello ]
posted 16 years ago
ok ive changed my name sorry about that. both the posts are different one i was having trouble navigating through tables, whilst the other i had trouble with the attributes. surely these are two different questions? can any1 help help me with this?
You can use position() function to locate <tr> and <td> elelemnts of interest. <xsl:template match="table"> <xsl:for-each select="tr[position() > 1]"> Car name: <xsl:value-of select="td[position()=1]"/> Car description <xsl:value-of select="td[position()=3]"/> </xsl:for-each> </xsl:template>