19 lines
477 B
Python
19 lines
477 B
Python
from lxml import etree
|
|
|
|
# загружаем XML
|
|
xml = etree.parse("specialities.xml")
|
|
|
|
# загружаем XSLT
|
|
xslt = etree.parse("specialities.xsl")
|
|
|
|
# создаем трансформацию
|
|
transform = etree.XSLT(xslt)
|
|
|
|
# применяем
|
|
result = transform(xml)
|
|
|
|
# сохраняем HTML
|
|
with open("specialities.html", "wb") as f:
|
|
f.write(etree.tostring(result, pretty_print=True, encoding="UTF-8"))
|
|
|
|
print("HTML успешно создан: specialities.html") |