Click to See Complete Forum and Search --> : use of XSL:Template


manishrathi
07-20-2009, 10:19 PM
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<tr>
<td>.</td>
<td>.</td>
</tr>
</table>
</body>
</html>
</xsl:template>

</xsl:stylesheet>


<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
.
.
</catalog>


I am confused with the use of xsl:template. xsl:template in this example produces one table. Can we have moe than one tempate in an xsl document ? Is xsl:template used for producing table only or can it be used for something ese also ? what is meant by applying template to the element ? what happens when template is applied to an element ?