xmltohtml.py
· 491 B · Python
Raw
from saxonche import *
def makehtml(infile,thexsl,outfile):
with PySaxonProcessor(license=False) as proc:
xsltproc = proc.new_xslt30_processor()
with open(infile,"r") as thefile:
document = proc.parse_xml(xml_text=thefile.read())
theexecutable = xsltproc.compile_stylesheet(stylesheet_file=thexsl)
theoutput = theexecutable.transform_to_string(xdm_node=document)
with open(outfile,"w") as thehtml:
thehtml.write(theoutput)
| 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) |