View Single Post
  #1 (permalink)  
Old Dec 12th, 2006, 22:12
emeakashah emeakashah is offline
New Member
Join Date: Dec 2006
Location: UK
Age: 27
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Need help on xsl and xpath

Hi all,
I'm having problem with my xsl project.I want to display all the xml data in a table using xsl.
My problem is why all my table display the same data(only the first data displayed and being repeated in other table).it seems that the program does not iterate even if i'm using for each.Can somebody help me????
XML file contains:

<tpeg_document generation_time="2006-11-28T02:44:56+0" >
<tpeg_message >
<originator country="UK" originator_name="BBC Travel News" />
<summary lang="en" > A8014 West Dunbartonshire - Traffic light failure on Kilbowie Road both ways at the A82 Great Western Road junction.
</summary>
.....
.....
.....

</tpeg_message>
<tpeg_message>.........</tpeg_message>

My XSL file:

<xsl:template match="tpeg_document" >
<xsl:apply-templates />
</xsl:template>
<xsl:template match="tpeg_message" >
<table border="1">
<xsl:for-each select="." >
<th colspan="2">Traffic Incidents</th>
<tr>
<td><b>Time of Incidents</b></td>
<td><xsl:value-of select="//@message_generation_time" /></td>
</tr>
<tr>
<td><b>Severity Factor</b></td>
<td><xsl:value-of select="//@severity_factor" /></td>
</tr>
<tr>
<td><b>Latitude</b></td>
<td><xsl:value-of select="//@latitude" /></td>
</tr>
<tr>
<td><b>Longitude</b></td>
<td><xsl:value-of select="//@longitude" /></td>
</tr>
<tr>
<td><b>Summary</b></td>
<td><xsl:value-of select="//summary" /></td></tr>
</xsl:for-each>
</table>
</xsl:template>
Reply With Quote