Re: [xsl] transformNode() and innerHTML combo fail to update

Subject: Re: [xsl] transformNode() and innerHTML combo fail to update
From: "Andrew" <asd@xxxxxxxxxx>
Date: Tue, 23 Dec 2003 13:22:36 +0300
OK, you want to manipulate table's content dynamically:
1) read this
2) you're using div(aroListing) element as direct child of table-it seems
you need to use tbody instead and add rows to it through insertRow() etc.
see (1)

Suggested solution(something like):
1) replace div(aroListing) on tbody
2)add to document another xml doc(aro.xsl):
   <xml id="test"></xml>
3) in (xsl.js)/sortWithValue instead of //aroListing.innerHTML = html;:

function sortWithValue(aSortValue)
  theXMLDoc = document.XMLDocument;
  theXSLDoc = document.XSLDocument;
  //----------  insert
  m= theXSLDoc.selectSingleNode( "//*[@method='html']");
   m.setAttribute( "method", "xml");
   m.setAttribute( "omit-xml-declaration", "yes");

  var node = theXSLDoc.selectSingleNode( "//xsl:sort/@select" );
  node.nodeValue = aSortValue;
  var html = theXMLDoc.documentElement.transformNode(theXSLDoc);
  //--------------------- insert

  newAro= document.createElement( "TBODY");
  aroListing.parentElement.appendChild( newAro);
  aroListing.removeNode( true); "aroListing";

  test.loadXML( "<tbody>"+html+"</tbody>");
  rs= test.documentElement.childNodes;
  for( i= 0; i< rs.length; i++){
   r= aroListing.insertRow();
   cl= rs[i].childNodes;
   for( j= 0; j< cl.length; j++)
                  r.insertCell().innerHTML= cl[j].xml;
  //------------------------ end
  //aroListing.innerHTML = html;

 XSL-List info and archive:

Current Thread