I'm pretty new to XSLT and i'm trying to convert some xhtml into a nicer looking xml format. Basically i'm trying to convert some user comments into something that looks like
<comment>
<from>me</from>
<pic>url</pic>
<message>hello world</message>
</comment>
and at the minute it looks like
Code:
<html>
<body>
...
<div id="header">...
<div id="content">
<table>
<tr>
<td valign="top" colspan="2">
<img align="right" src="ProfilePic.jpg" />
<a href="Profile.php?id=abc">Me</a>
<br />
hello world
</td>
</tr>
<tr>
<td>
<img align="right" src="ProfilePic.jpg">
<a href="Profile.php?id=123">you</a>
<br />
hello world again
</td>
</tr>
etc...
I was able to work out the XPath as i have experience using it but when it comes to converting all the information as much as i was able to get was
Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Hello World</h2>
<b>Items</b>
<table border="1">
<xsl:for-each select="Xpath to the "<td>" for each comment">
<tr>
<xsl:value-of select="what goes here?">
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
any help would be greatly appreciated :D