Using XSLT to convert a XML file to a table-need help ???

admin

Administrator
Staff member
Hi all,
Suppose we have a XML file describe products as follow:
<?xml version="1.0" encoding="utf-8" ?>
<store>
<product>
<ImageUrl>product1.gif</ImageUrl>
<Name>Screen</Name>
<Price>12</Price>
</product>
<product>
<ImageUrl>product2.gif</ImageUrl>
<Name>Printer</Name>
<Price>15</Price>
</product>
<product>
<ImageUrl>product3.gif</ImageUrl>
<Name>Printer</Name>
<Price>20</Price>
</product>
</store>
If we want to show 3 products per a line (and suppose we have many lines) as follow:
<table>
<tr>
<td>
...//product i info
</td>
<td>
...//product i+1 info
</td>
<td>
..//product i+2 info
</td>
</tr>
<tr>
<td>
...//product i+3 info
</td>
<td>
...//product i+4 info
</td>
<td>
..//product i+5 info
</td>
</tr>
..... //product i+n info
</table>

How can we obtain this by using XSLT ?
Thanks a lot !
 
Back
Top