menu.xml
<?xml version="1.0"?>
<catalog>
<cd>
<item>Veg. burger</item><price>35</price>
</cd>
<cd>
<item>Chicken burger</item><price>55</price>
</cd>
<cd>
<item>Pizza</item><price>75</price>
</cd>
<cd>
<item>Paneer Tikka</item><price>65</price>
</cd>
<cd>
<item>Salad</item><price>20</price>
</cd>
<cd>
<item>Butter Chicken</item><price>175</price>
</cd>
</catalog>
menuxml.xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>RESTAURANT MENU</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>item</th><th>price</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="item"/></td><td><xsl:value-of select="price"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0"?>
<catalog>
<cd>
<item>Veg. burger</item><price>35</price>
</cd>
<cd>
<item>Chicken burger</item><price>55</price>
</cd>
<cd>
<item>Pizza</item><price>75</price>
</cd>
<cd>
<item>Paneer Tikka</item><price>65</price>
</cd>
<cd>
<item>Salad</item><price>20</price>
</cd>
<cd>
<item>Butter Chicken</item><price>175</price>
</cd>
</catalog>
menuxml.xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>RESTAURANT MENU</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>item</th><th>price</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="item"/></td><td><xsl:value-of select="price"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
No comments:
Post a Comment