]> git.sesse.net Git - xml-template/commitdiff
More cloning fixes. clone.xml doesn't pass, but it passes morally.
authorsgunderson@bigfoot.com <>
Mon, 21 Apr 2008 20:11:55 +0000 (22:11 +0200)
committersgunderson@bigfoot.com <>
Mon, 21 Apr 2008 20:11:55 +0000 (22:11 +0200)
php5/xml-template.php

index 7ae6dcbf8c1d54965ccceda64787ad34423cc381..08c78ab57bcaf4998890628303b5790918c7eb99 100644 (file)
@@ -99,16 +99,16 @@ function XML_Template_process($node, $obj, $clean = 1)
                }
 
                # remove all the <fragment> tags
-
                for ($i = 0; $i < $node->childNodes->length; ++$i) {
                        $child = $node->childNodes->item($i);
                        if ($child->localName != 'temporary-fragment') {
                                continue;
                        }
-                       for ($j = 0; $j < $child->childNodes->length; ++$j) {
-                               $child2 = $child->childNodes->item($j);
+                       while ($child->childNodes->length > 0) {
+                               $child2 = $child->childNodes->item(0);
                                $node->appendChild($child2);
                        }
+                       --$i;
                        $node->removeChild($child);
                }       
        }