XSLTools

XSLForms/Prepare.py

3:e96db0ca6952
2004-12-20 paulb [project @ 2004-12-20 18:55:20 by paulb] Fixed module docstring. Added a parameter so that values which are lists of actual values may be handled. Exposed instance creation as a "public" method.
     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