Laboratory_2

This commit is contained in:
nikbel2004@outlook.com 2024-09-15 23:46:31 +04:00
parent a0a3fd0be4
commit 7849dd4531
4 changed files with 23 additions and 30 deletions

View File

@ -1,14 +0,0 @@
import http.server
import socketserver
PORT = 8000
DIRECTORY = "."
class Handler(http.server.SimpleHTTPRequestHandler):
def __init__(self, *args, **kwargs):
super().__init__(*args, directory=DIRECTORY, **kwargs)
# Запуск сервера на порту 8000
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print(f"Serving at http://localhost:{PORT}")
httpd.serve_forever()

15
Lab 2/library.dtd Normal file
View File

@ -0,0 +1,15 @@
<!DOCTYPE library [
<!ELEMENT library (book+)>
<!ELEMENT book (title, author, genre, year)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT genre (#PCDATA)>
<!ELEMENT year (#PCDATA)>
<!ATTLIST book ISBN CDATA #REQUIRED>
<!ATTLIST book available CDATA #REQUIRED>
<!ATTLIST book publisher CDATA #IMPLIED>
<!ATTLIST book language CDATA #IMPLIED>
]>

View File

@ -1,34 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="library.xslt"?> <?xml-stylesheet type="text/xsl" href="library.xslt"?>
<?xml-model href="library.dtd" type="applecation/xml-dtd"?>
<library> <library>
<book> <book ISBN="978-3-16-148410-0" available="yes" publisher="Penguin" language="English">
<title>War and Peace</title> <title>War and Peace</title>
<author>Leo Tolstoy</author> <author>Leo Tolstoy</author>
<genre>Historical</genre> <genre>Historical</genre>
<year>1869</year> <year>1869</year>
</book> </book>
<book> <book ISBN="978-5-17-085410-0" available="no" language="Russian">
<title>The Captain's Daughter</title> <title>The Captain's Daughter</title>
<author>Alexander Pushkin</author> <author>Alexander Pushkin</author>
<genre>Novel</genre> <genre>Novel</genre>
<year>1836</year> <year>1836</year>
</book> </book>
<book> <book ISBN="978-5-11-022410-0" available="yes" language="French">
<title>Crime and Punishment</title>
<author>Fyodor Dostoevsky</author>
<genre>Philosophical</genre>
<year>1866</year>
</book>
<book>
<title>The Three Musketeers</title> <title>The Three Musketeers</title>
<author>Alexandre Dumas</author> <author>Alexandre Dumas</author>
<genre>Historical novel</genre> <genre>Historical novel</genre>
<year>1844</year> <year>1844</year>
</book> </book>
<book> <!-- Остальные книги... -->
<title>Fifteen-year-old captain</title>
<author>Jules Verne</author>
<genre>Novel</genre>
<year>1878</year>
</book>
</library> </library>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Шаблон для корневого элемента -->
<xsl:template match="/"> <xsl:template match="/">
<html> <html>
<head> <head>