2024-09-15 23:43:56 +04:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
|
|
|
2024-09-15 23:46:31 +04:00
|
|
|
<!-- Шаблон для корневого элемента -->
|
2024-09-15 23:43:56 +04:00
|
|
|
<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>
|