• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Extracting Data From Tables in XHTML using XSL

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Kevin Celentano
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!