# HG changeset patch # User paulb # Date 1106672434 0 # Node ID 7ef971673d9370974974ec502898a55ab373e598 # Parent 76ae67a06159f20060e07ce501fc6d189d10ebc8 [project @ 2005-01-25 17:00:34 by paulb] Added string parameter support to XSLOutput. diff -r 76ae67a06159 -r 7ef971673d93 XSLOutput.py --- a/XSLOutput.py Fri Jan 21 13:44:47 2005 +0000 +++ b/XSLOutput.py Tue Jan 25 17:00:34 2005 +0000 @@ -18,14 +18,16 @@ A handler which can prepare output for an XMLTools2 template. """ - def __init__(self, filenames, references=None): + def __init__(self, filenames, references=None, parameters=None): """ Initialise the handler with the 'filenames' of stylesheets producing the final output, a 'references' dictionary indicating related stylesheets. + Additional 'parameters' may also be specified as a dictionary. """ self.references = references or {} + self.parameters = parameters or {} # Remember the stylesheet documents. @@ -86,6 +88,8 @@ parameters = {} for name, reference in self.references.items(): parameters[name.encode("utf-8")] = ("document('%s')" % reference).encode("utf-8") + for name, parameter in self.parameters.items(): + parameters[name.encode("utf-8")] = ("'%s'" % parameter).encode("utf-8") last_result = document for stylesheet in self.stylesheets: