9/21/21

WEB TECHNOLOGIES LAB EXERCISE 6

 BOOK.XSL

<?xml version = "1.0" encoding = "UTF-8"?>
<xsl:stylesheet version = "1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2 align="center"> BOOKS INFORMATION </h2>
<table border="2" align="center">
<tr bgcolor="#9acd32">
<th> TITLE </th>
<th> AUTHOR </th>
<th> PUBLISHER </th>
<th> PRICE </th>
</tr>
<xsl:for-each select="bookstore/book">
<tr>
<td><xsl:value-of select="title" /></td>
<td><xsl:value-of select="author" /></td>
<td><xsl:value-of select="publisher" /></td>
<td><xsl:value-of select="price" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

BOOK.DTD

<!ELEMENT bookstore (book*)>
<!ELEMENT book (title,author,publisher,price)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT publisher (#PCDATA)>
<!ELEMENT price (#PCDATA)>

BOOK.XML

<?xml version = "1.0"?>
<!DOCTYPE bookstore SYSTEM "book.dtd">
<?xml-stylesheet type="text/xsl" href="book.xsl"?>
<bookstore>
<book>
<title>WT</title>
<author>pankaj sharma</author>
<publisher>S K Kataria and Sons</publisher>
<price>465</price>
</book>
<book>
<title>AI</title>
<author>Chandra S.S.V</author>
<publisher>PHI Learning</publisher>
<price>472</price>
</book>
</bookstore>


No comments:

Blog Archive