From a1cfd19c4c66e6c78740427fc8bb905037b409d9 Mon Sep 17 00:00:00 2001 From: "sgunderson@bigfoot.com" <> Date: Wed, 6 Sep 2006 18:30:00 +0200 Subject: [PATCH] Fix some possible attribute issues with the Python code, and make it clean away the xmlns stuff. --- python/xmltemplate.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/python/xmltemplate.py b/python/xmltemplate.py index 6b9c50b..1953149 100644 --- a/python/xmltemplate.py +++ b/python/xmltemplate.py @@ -32,13 +32,21 @@ def process(node, obj, clean = True): id = None attrs = child.attributes + attrs_to_remove = [] if not attrs is None: for i in range(attrs.length): attr = attrs.item(0) if attr.namespaceURI == "http://template.sesse.net/" or attr.name == "id": id = attr.value if clean: - child.removeAttribute(attr.name) + attrs_to_remove.append(attr.name) + if attr.name.startswith("xmlns:") and attr.value == "http://template.sesse.net/" and clean: + attrs_to_remove.append(attr.name) + + for a in attrs_to_remove: + if child.hasAttribute(a): + child.removeAttribute(a) + # check all substitutions to see if we found anything # appropriate -- 2.39.2