MiAKD/Lab 1/library.xslt
nikbel2004@outlook.com 86094e3d5a AllLabs
2024-09-15 23:54:00 +04:00

47 lines
1.6 KiB
HTML

<?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>
<head>
<title>Library</title>
<style>
table {
width: 70%;
border-collapse: collapse;
margin: 20px auto;
}
th, td {
border: 1px solid black;
padding: 10px;
text-align: left;
}
th {
background-color: #9acd32;
}
</style>
</head>
<body>
<h2 style="text-align: center;">Library Books</h2>
<table>
<tr>
<th>Title</th>
<th>Author</th>
<th>Genre</th>
<th>Year</th>
</tr>
<!-- Цикл по элементам book -->
<xsl:for-each select="library/book">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="author"/></td>
<td><xsl:value-of select="genre"/></td>
<td><xsl:value-of select="year"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>