Can I use xml/xslt for dynamic html generation in my code behind with my data in dataset.
I have a requirement where i will have to show top 5 news in my home page. SO what i have thot is:
- After the page is loaded, I will call a web service which will send me html version of my top 5 news. (Ajax way)
- Using javascript I will insert the returned formatted html string inside a div tag.
Ok, But I was looking for some good way of generating the formatted html. My actual data is inside a DataTable. I was wondering wether this can be done by xslt & xml or not.
I had earlier used StringBuilder way to make the dynamic html after inemurating the DataTable, but I dont feel that its not the preferred way because if later i have to add some extra formatting then i have to again modify my code & publish the dll.
Just wanted to know what techniques should be used for such kind of scenarios. Need your valuable suggestions and if possible sample links.
Sample DataTable:
Id- Heading - Description - link
1 - hello - how are you - yahoo.com
2 - bye - I am leaving - google.com
Sample output Html:
<table>
<tr id='1'>
<td >hello</td><td ><a href='yahoo.com'>how are you</a></td>
</tr>
<tr id='1'>
<td >bye</td><td ><a href='google.com'>I am leaving</a></td>
</tr>
</table>
Thanks & Kind regards.
M