From fb3de693de0c047712fe39b947539917bf5d9f93 Mon Sep 17 00:00:00 2001 From: "sgunderson@bigfoot.com" <> Date: Sun, 13 Aug 2006 00:16:46 +0200 Subject: [PATCH] Yet more cloning fixes for PHP. *sigh* --- php/xml-template.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/php/xml-template.php b/php/xml-template.php index 51f86a5..1a7434a 100644 --- a/php/xml-template.php +++ b/php/xml-template.php @@ -37,10 +37,7 @@ function XML_Template_process($node, $obj, $clean = 1) $attrs = $child->attributes(); if (isset($attrs)) { foreach ($child->attributes() as $attr) { - // PHP's DOMXML module forgets the prefix information when - // cloning nodes, so we'll have to avoid the namespace check - // here, unfortunately - if (/* $attr->namespace_uri() == 'http://template.sesse.net/' && */ $attr->name() == 'id') { + if ($attr->namespace_uri() == 'http://template.sesse.net/' && $attr->name() == 'id') { $id = $attr->value(); if ($clean) { // FIXME: this won't work since we're not in the right namespace @@ -159,7 +156,10 @@ function own_clone_node($node, $doc) if (isset($attrs)) { foreach ($node->attributes() as $attr) { $attr2 = $doc->create_attribute($attr->name(), $attr->value()); - $attr2->set_namespace($attr->namespace_uri(), $attr->prefix()); + $nsuri = $attr->namespace_uri(); + if (isset($nsuri)) { + $attr2->set_namespace($nsuri, $attr->prefix()); + } $newnode->append_child($attr2); } } -- 2.39.2