xsl-list
[Top] [All Lists]

Re: transformNode() and innerHTML combo fail to update

2003-12-23 03:22:36
OK, you want to manipulate table's content dynamically:
1) read this
http://msdn.microsoft.com/workshop/author/tables/buildtables.asp
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):
...
<head>
   <xml id="test"></xml>
    ...
</head>
...
3) in (xsl.js)/sortWithValue instead of //aroListing.innerHTML = html;:

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

  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);
  newAro.id= "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:  http://www.mulberrytech.com/xsl/xsl-list