Last active 2 weeks ago

xmltohtml.py Raw
1from saxonche import *
2
3def makehtml(infile,thexsl,outfile):
4 with PySaxonProcessor(license=False) as proc:
5 xsltproc = proc.new_xslt30_processor()
6 with open(infile,"r") as thefile:
7 document = proc.parse_xml(xml_text=thefile.read())
8 theexecutable = xsltproc.compile_stylesheet(stylesheet_file=thexsl)
9 theoutput = theexecutable.transform_to_string(xdm_node=document)
10 with open(outfile,"w") as thehtml:
11 thehtml.write(theoutput)