]> git.sesse.net Git - xml-template/blobdiff - c++0x/attribute2.cpp
Add Alternate support to C++0x version, and corresponding attribute2 test.
[xml-template] / c++0x / attribute2.cpp
diff --git a/c++0x/attribute2.cpp b/c++0x/attribute2.cpp
new file mode 100644 (file)
index 0000000..94cf17d
--- /dev/null
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+#include "xml-template.h"
+
+using namespace std;
+
+int main(int argc, char **argv)
+{
+       Substitute master_directive = {
+               make_pair("color", new Replace("blue")),
+               make_pair("#things", new Alternate { "li/class", {
+                       new Substitute { make_pair("li", new Replace("Raindrops on roses")), },
+                       new Substitute { make_pair("li", new Replace("Whiskers on kittens")), },
+                       new Substitute { make_pair("li", new Replace("Bright copper kettles")), },
+                       new Substitute { make_pair("li", new Replace("Warm, woolen mittens")), },
+               }, { "odd", "even" } }),
+       };
+
+       process_file("../xml/clone.xml", argv[1], &master_directive);
+       return(0);
+}