1.1 --- a/scripts/xslform_extract.py Fri Jan 27 00:43:49 2006 +0000
1.2 +++ b/scripts/xslform_extract.py Fri Jan 27 00:44:13 2006 +0000
1.3 @@ -11,9 +11,9 @@
1.4 output_xml = sys.argv[2]
1.5 element_id = sys.argv[3]
1.6 except IndexError:
1.7 - print "Please specify an output template, an output filename and an element identifier."
1.8 + print "Please specify a template, an output filename and a template node identifier."
1.9 print "For example:"
1.10 - print "xslform_extract.py output.xsl output_element.xsl element"
1.11 + print "xslform_extract.py template.xhtml output_element.xsl identifier"
1.12 sys.exit(1)
1.13
1.14 XSLForms.Prepare.make_stylesheet_fragment(input_xml, output_xml, element_id)
2.1 --- a/scripts/xslform_output.py Fri Jan 27 00:43:49 2006 +0000
2.2 +++ b/scripts/xslform_output.py Fri Jan 27 00:44:13 2006 +0000
2.3 @@ -7,6 +7,15 @@
2.4 import libxml2dom
2.5 import sys
2.6
2.7 +def get_dict(marker):
2.8 + d = {}
2.9 + if marker in sys.argv:
2.10 + i = sys.argv.index(marker) + 1
2.11 + while i < len(sys.argv) and not sys.argv[i].startswith("--"):
2.12 + d[sys.argv[i]] = sys.argv[i+1]
2.13 + i += 2
2.14 + return d
2.15 +
2.16 if __name__ == "__main__":
2.17 try:
2.18 input_xml = sys.argv[1]
2.19 @@ -16,9 +25,17 @@
2.20 print "Please specify an input filename, a template filename and an output filename."
2.21 print "For example:"
2.22 print "xslform_output.py input.xml output.xsl output.xhtml"
2.23 + print
2.24 + print "Additional references may be specified in parameter name and value pairs."
2.25 + print "For example:"
2.26 + print "--references translations translations.xml"
2.27 + print "--parameters locale en_GB"
2.28 sys.exit(1)
2.29
2.30 - proc = XSLOutput.Processor([trans_xsl])
2.31 + references = get_dict("--references")
2.32 + parameters = get_dict("--parameters")
2.33 +
2.34 + proc = XSLOutput.Processor([trans_xsl], references=references, parameters=parameters)
2.35 proc.send_output(open(output_xml, "wb"), "utf-8", libxml2dom.parse(input_xml))
2.36
2.37 # vim: tabstop=4 expandtab shiftwidth=4