1 #!/usr/bin/env python 2 3 """ 4 Preparation of templating stylesheets. 5 """ 6 7 import XSLOutput 8 import libxml2dom 9 import os 10 11 resource_dir = os.path.join(os.path.split(__file__)[0], "XSL") 12 13 def make_stylesheet(template_name, output_name, stylesheet_name="Prepare.xsl", encoding="utf-8"): 14 global resource_dir 15 proc = XSLOutput.Processor([os.path.join(resource_dir, stylesheet_name)]) 16 template = libxml2dom.parse(template_name) 17 proc.send_output(open(output_name, "wb"), encoding, template) 18 19 # vim: tabstop=4 expandtab shiftwidth=4