--- /dev/null
+#! /usr/bin/python
+import xmltemplate
+
+doc = xmltemplate.process_file("../xml/clone.xml", {
+ 'color': 'blue',
+ '#things': (
+ { "li": "Raindrops on roses", "li/class": "even" },
+ { "li": "Whiskers on kittens", "li/class": "odd" },
+ { "li": "Bright copper kettles", "li/class": "even" },
+ { "li": "Warm, woolen mittens", "li/class": "odd" }
+ )
+})
+print doc.toxml()
--- /dev/null
+#! /usr/bin/python
+import xmltemplate
+
+doc = xmltemplate.process_file("../xml/clone.xml", {
+ "color": "blue",
+ "#things": xmltemplate.alternate("li/class", (
+ { "li": "Raindrops on roses" },
+ { "li": "Whiskers on kittens" },
+ { "li": "Bright copper kettles" },
+ { "li": "Warm, woolen mittens"},
+ ), "odd", "even")
+});
+print doc.toxml()
--- /dev/null
+#! /usr/bin/python
+import xmltemplate
+
+doc = xmltemplate.process_file("../xml/clone.xml", {
+ 'color': 'blue',
+ '#things': (
+ { 'li': 'Raindrops on roses' },
+ { 'li': 'Whiskers on kittens' },
+ { 'li': 'Bright copper kettles' },
+ { 'li': 'Warm, woolen mittens' }
+ )
+})
+print doc.toxml()
--- /dev/null
+#! /usr/bin/python
+import xmltemplate
+
+doc = xmltemplate.process_file("../xml/included.xml", {
+ "color": "red"
+}, False)
+master = xmltemplate.process_file("../xml/master.xml", {
+ "title": "Main HTML title",
+ "h1": "Nice heading here",
+ "contents": doc
+});
+print master.toxml()