--- /dev/null
+<?php
+require('xml-template.php');
+
+$doc = XML_Template_process_file('clone.xml', array(
+ 'color' => 'blue',
+ '#things' => array(
+ array( 'li' => 'Raindrops on roses' ),
+ array( 'li' => 'Whiskers on kittens' ),
+ array( 'li' => 'Bright copper kettles' ),
+ array( 'li' => 'Warm, woolen mittens' )
+ )
+));
+print $doc->dump_mem();
+?>
XML_Template_process($child, $obj, $clean, $nsup);
}
}
+ } else { # repeat
+ $doc = $node->owner_document();
+ $frag = $doc->create_element("temporary-fragment"); # ugh
+
+ foreach ($node->child_nodes() as $child) {
+ $frag->append_child($child);
+ $node->remove_child($child);
+ }
+
+ foreach ($obj as $instance) {
+ $newnode = $frag->clone_node(true);
+ $node->append_child($newnode);
+ XML_Template_process($newnode, $instance, $clean, $nsup);
+
+ # FIXME: clean
+ }
+
+ # remove all the <fragment> tags
+
+ foreach ($node->child_nodes() as $child) {
+ if ($child->name() != 'temporary-fragment') {
+ continue;
+ }
+ foreach ($child->child_nodes() as $child2) {
+ $node->append_child($child2);
+ }
+ $node->remove_child($child);
+ }
+
+ return;
}
+
# FIXME: repeat
# FIXME: clean
}