tre revised this gist 2 weeks ago. Go to revision
No changes
tre revised this gist 2 weeks ago. Go to revision
1 file changed, 11 insertions
xmltohtml.py(file created)
| @@ -0,0 +1,11 @@ | |||
| 1 | + | from saxonche import * | |
| 2 | + | ||
| 3 | + | def 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) | |
Newer
Older