Webtech 5
Webtech 5
NAME: Anurag
Dhruv Jangid
Upadhyay
ROLL NO. :2200271690019
2200270100040
OBJECTIVE: Write a program in XML for creation of DTD, which specifies set of rules. Create a style
sheet in CSS/ XSL & display the document in internet explorer
CODE:
<!DOCTYPE books [
]>
<xsl:template match="/">
<html>
<head>
<title>Book List</title>
<style>
body {
background-color: #f9f9f9;
color: #333;
margin: 0;
padding: 20px;
h1 {
color: #2c3e50;
text-align: center;
margin-bottom: 20px;
table {
width: 100%;
border-collapse: collapse;
margin: 0 auto;
th, td {
padding: 12px;
text-align: left;
th {
background-color: #3498db;
color: white;
tr:nth-child(even) {
background-color: #f2f2f2;
tr:hover {
background-color: #d1e7dd;
display: block;
th {
position: absolute;
left: -9999px;
}
tr {
margin-bottom: 10px;
td {
text-align: right;
padding-left: 50%;
position: relative;
td:before {
content: attr(data-label);
position: absolute;
padding-left: 10px;
font-weight: bold;
text-align: left;
</style>
</head>
<body>
<h1>Book List</h1>
<table>
<tr>
<th>Title</th>
<th>Author</th>
<th>Year</th>
<th>Price</th>
</tr>
<xsl:for-each select="books/book">
<tr>
<td data-label="Title"><xsl:value-of select="title"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<books>
<book>
<author>John Doe</author>
<year>2023</year>
<price>29.99</price>
</book>
<book>
<title>Advanced XML</title>
<author>Jane </author>
<year>2022</year>
<price>39.99</price>
</book>
</books>
OUTPUT