Well after looking at the template thing you posted with your link it
seems to me like PHP is used to create working XML. So i wonder why
you are using AJAX here.
Now could it be that you use appendChild() ? That function would
simply add the XML again.

It's not easy to tell if you are not showing the JavaScript code ..
Still it simply depends on how you are importing the node you get from
XMLHttpRequest() or responseXML

Btw. importNode() is not working on all Browsers ..
Below is a code snipped I use for my AJAX class in JavaScript to copy
a node of one XML document (like from responseXML) into another. It
works in IE6+ and all W3C compliant browsers.
To make this work you will still have to make some ajustments.

xml_obj.prototype.xml_import_node = function(node, to_node,
all_children) { // cross browser importNode, NOTE: if toNode not
specified it will be set to current root_element
// appends node as a child to to_node
        // if all_children is true then all child nodes will be imported too
        /* NOTE TYPES:
        ELEMENT_NODE = 1;
        ATTRIBUTE_NODE = 2;
        TEXT_NODE = 3;
        CDATA_SECTION_NODE = 4;
        ENTITY_REFERENCE_NODE = 5;
        ENTITY_NODE = 6;
        PROCESSING_INSTRUCTION_NODE = 7;
        COMMENT_NODE = 8;
        DOCUMENT_NODE = 9;
        DOCUMENT_TYPE_NODE = 10;
        DOCUMENT_FRAGMENT_NODE = 11;
        NOTATION_NODE = 12;
        */
        if (!node) return false;
        if (!this.DOC) this.DOC = document;
        if (!to_node.nodeType) {
                if (!this.XML) return false;
                try {
                        to_node = this.XML.documentElement;
                        this.DOC = this.XML;
                } catch(e) {
                        return false;
                }
        }
        try {
                if (!node.nodeType) return false;
                switch (node.nodeType) {
                                case 1: // new element
                                        var new_node = 
this.DOC.createElement(node.nodeName);
                                        if (node.attributes && 
(node.attributes.length > 0)) { // if it
has attributes
                                                for (var count = 0; (count < 
node.attributes.length); count++) {
                                                        
this.xml_import_node(node.attributes[count], new_node);
                                                }
                                        }
                                        if (all_children && (node.childNodes && 
(node.childNodes.length >
0))) { // if child nodes
                                                var dump = null;
                                                for (var count = 0; (count < 
node.childNodes.length); count++) {
                                                        
this.xml_import_node(node.childNodes[count], new_node, true);
                                                }
                                        }
                                        to_node.appendChild(new_node);
                                        return new_node;
                                        break;
                                case 2: // new attribute
                                        var name = node.nodeName;
                                        switch (node.nodeName.toLowerCase()) {
                                                case 'onload':
                                                case 'onunload':
                                                case 'onblur':
                                                case 'onclick':
                                                case 'ondblclick':
                                                case 'onfocus':
                                                case 'onkeydown':
                                                case 'onkeypress':
                                                case 'onkeyup':
                                                case 'onmousedown':
                                                case 'onmousemove':
                                                case 'onmouseout':
                                                case 'onmouseover':
                                                case 'onmouseup':
                                                        var eval_code = 
'to_node.'+node.nodeName.toLowerCase();
                                                        eval_code += ' = 
function() { '+node.nodeValue+' };';
                                                        eval(eval_code);
                                                        break;
                                                case 'style':
                                                        to_node.style.cssText = 
node.nodeValue; // IE FIX
                                                        // no break
                                                case 'class':
                                                        to_node.className = 
node.nodeValue; //IE FIX
                                                        // no break
                                                default:
                                                        
to_node.setAttribute(node.nodeName, node.nodeValue);
                                        }
                                        return to_node;
                                        break;
                                case 3: // new text_node
                                case 4: // new cdata section
                                case 8: // new comment node
                                        
to_node.appendChild(this.DOC.createTextNode(node.nodeValue));
                                        return to_node;
                                        break;
                                case 5: // new entity reference
                                case 6: // new entity node
                                case 7: // new processing instruction
                                case 9: // new document node
                                case 10: // new document type node
                                case 11:  // new fragment node
                                case 12: // new notation node
                                        return null; // not needed. if you want 
it then implement it
                                        break;
                                default: return false;
                }
        } catch(e) {
                alert(e.message);
                return false;
        }
}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to