1.1 --- a/scripts/xslform_output.py Fri Jan 27 00:43:49 2006 +0000
1.2 +++ b/scripts/xslform_output.py Fri Jan 27 00:44:13 2006 +0000
1.3 @@ -7,6 +7,15 @@
1.4 import libxml2dom
1.5 import sys
1.6
1.7 +def get_dict(marker):
1.8 + d = {}
1.9 + if marker in sys.argv:
1.10 + i = sys.argv.index(marker) + 1
1.11 + while i < len(sys.argv) and not sys.argv[i].startswith("--"):
1.12 + d[sys.argv[i]] = sys.argv[i+1]
1.13 + i += 2
1.14 + return d
1.15 +
1.16 if __name__ == "__main__":
1.17 try:
1.18 input_xml = sys.argv[1]
1.19 @@ -16,9 +25,17 @@
1.20 print "Please specify an input filename, a template filename and an output filename."
1.21 print "For example:"
1.22 print "xslform_output.py input.xml output.xsl output.xhtml"
1.23 + print
1.24 + print "Additional references may be specified in parameter name and value pairs."
1.25 + print "For example:"
1.26 + print "--references translations translations.xml"
1.27 + print "--parameters locale en_GB"
1.28 sys.exit(1)
1.29
1.30 - proc = XSLOutput.Processor([trans_xsl])
1.31 + references = get_dict("--references")
1.32 + parameters = get_dict("--parameters")
1.33 +
1.34 + proc = XSLOutput.Processor([trans_xsl], references=references, parameters=parameters)
1.35 proc.send_output(open(output_xml, "wb"), "utf-8", libxml2dom.parse(input_xml))
1.36
1.37 # vim: tabstop=4 expandtab shiftwidth=4