Subject: [xsl] search & clone problem From: "Walter Torres" <walter@xxxxxxxxx> Date: Wed, 17 Jan 2001 19:41:53 -0600 |
I am having some trouble with a search and clone piece. I am doing a search on some data, by (user selected) NODE. And each time we have a match, I CLONE this NODE Tree to my second XML Object... This is my code... ( see below ) ( An outline of my data is below. ) What I am getting in my stoarage XML Object is... <L-1> <L-4> <I-1></I-1> <I-2></I-2> </L-4> <L-2> <L-3> </L-3> </L-2> </L-1> It seems that when I clone the NODE tree into the storage XML it places itself as the second level node not the fourth, as it needs to be so the XSL can display it properly. Can anyone enlighten me on how I can get these cloned NODES to place themselves in their proper place? I know I am missing something simple here. But I figure this is my 3rd week of doing this, so I might be allowed to miss the obvious. Thanks for any help. Walter ================================== // What NODE do we search from and subNODE was selected // My Levels / L-1 / L-2 / L-3 / L-4 var mainNode = '/callEvent/response/interaction_list/interaction'; var searchNode = mainNode + srchType.value; // via pick list // Retrieve the NODES from our selected NODE path var items = xmlDocRoot.selectNodes ( searchNode ); // Loop through these returned NODEs for (i = 0; i < items.length; i++) { // Get this iterative item var curItem = xmlDocRoot.selectNodes(searchNode).item(i); // Do the search on this item if ( curItem.text.search(searchStr) != -1 ) { // Pull out the entire NODE Tree for this item var cloneTree = xmlDocRoot.selectNodes(mainNode).item(i).cloneNode(true); // Stick it over in our storage XML Object - objXMLset objXMLset.documentElement.insertBefore(cloneTree, objXMLset.documentElement.firstChild); } } // for (i = 0; i < items.length; i++) ================================== This is my orignal data <L-1> <L-2> <L-3> <L-4> <I-1></I-1> <I-2></I-2> </L-4> </L-3> </L-2> </L-1> This is my empty shell that this data is supposed to be cloned into. <L-1> <L-2> <L-3> Found items go here </L-3> </L-2> </L-1> But... <L-1> But the found items are going here <L-2> <L-3> leaving this area empty </L-3> </L-2> </L-1> // eof XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSL FO, Carmelo Montanez | Thread | RE: [xsl] search & clone problem, Chris Bayes |
Re: [xsl] XSL FO, Carmelo Montanez | Date | [xsl] RE: How to transform <BR> to , Dimitre Novatchev |
Month |