X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=php5%2Fxml-template.php;h=e6a4e1909d2f0dc4153fbd644ec6797b0040587c;hb=0ecfe47a8aa78fa065284fe74bba628bde9de181;hp=b28db156ebf2cf6e6ffe1f637a3b579a299e7df8;hpb=e917db04f37ab3be79a0634a5ef22358d35a9075;p=xml-template diff --git a/php5/xml-template.php b/php5/xml-template.php index b28db15..e6a4e19 100644 --- a/php5/xml-template.php +++ b/php5/xml-template.php @@ -49,14 +49,13 @@ function XML_Template_process($node, $obj, $clean = 1) if (isset($attrs)) { $replace_child = 0; - foreach ($child->attributes as $attr) { - if ($attr->namespaceURI == 'http://template.sesse.net/' && $attr->name == 'id') { - $id = $attr->value; - if ($clean) { - $child->removeAttributeNode($attr); - $replace_child = 1; - } - } + $id_node = $child->getAttributeNodeNS('http://template.sesse.net/', 'id'); + if (isset($id_node)) { + $id = $id_node->value; + if ($clean) { + $child->removeAttributeNode($id_node); + $replace_child = 1; + } } # This seems to be the only way to reliably get rid of the excess