Mam problem z advAJAX, tzn nie tyle dziwny co dość specyficzny nie mogę wykombinować jak użyć wyniku jednego wywołania do obróbki drugiego. Chodzi o to że najpierw pobieram plik xml, a potem arkusz xsl. dopiero po spracowaniu (w js) daje to na diva. Nie mogę właśnie wykombinować jak uzyskać wynik tego wywołania poza advAJAX.get({...}); żeby potem połączyć go z drugim takim wynikiem.

edit: dobra, wy główkowałem coś takiego:

  1. <?php
  2. function createTranslate( seylesheet ){
  3. var stylesheetDoc = false;
  4. if (this.DOMParser){
  5. var dp = new DOMParser();
  6. stylesheetDoc = dp.parseFromString(seylesheet, "text/xml");
  7. }else if (window.ActiveXObject){
  8. stylesheetDoc = createMsxml2DOMDocumentObject();  
  9. stylesheetDoc.async = false;  
  10. stylesheetDoc.load(seylesheet);
  11. }
  12. return( stylesheetDoc );
  13. }
  14.  
  15. function createMsxml2DOMDocumentObject(){
  16. var msxml2DOM;
  17.  var msxml2DOMDocumentVersions = new Array("Msxml2.DOMDocument.6.0",
  18. "Msxml2.DOMDocument.5.0",
  19. "Msxml2.DOMDocument.4.0");
  20. for (var i=0; i<msxml2DOMDocumentVersions.length && !msxml2DOM; i++){
  21. try{ 
  22. msxml2DOM = new ActiveXObject(msxml2DOMDocumentVersions[i]);
  23. }catch (e) {}
  24.  }
  25. if (!msxml2DOM)
  26. alert("Uaktualnij swojÄ… wersjÄ™ MSXML ze ĹşrĂłdĹ‚a n" +
  27. "http://msdn.microsoft.com/XML/XMLDownloads/default.aspx");
  28. else 
  29. return msxml2DOM;
  30. }
  31. function sparse(gridDivId, xml, xsl){ 
  32. if (window.XMLHttpRequest && window.XSLTProcessor && 
  33. window.DOMParser){  
  34. var xsltProcessor = new XSLTProcessor();
  35. xsltProcessor.importStylesheet(xsl);
  36. page = xsltProcessor.transformToFragment(xml, document);
  37. var gridDiv = document.getElementById(gridDivId);
  38. gridDiv.innerHTML = "";
  39. gridDiv.appendChild(page);
  40.  
  41. }else if (window.ActiveXObject){
  42. var theDocument = createMsxml2DOMDocumentObject();
  43. theDocument.async = false;
  44. theDocument.load(xml);
  45. var gridDiv = document.getElementById(gridDivId);
  46. gridDiv.innerHTML = theDocument.transformNode(xsl);
  47. }
  48. }
  49.  
  50. advAJAX.get({
  51. url: "getdata.php",
  52. parameters : {
  53. "action" : "xmlfile"
  54. },
  55. onSuccess : function(obj) { 
  56. xmlObj = obj.responseXML;
  57. advAJAX.get({
  58. url: "newsmain.xsl" ,
  59. onSuccess : function(obj) {
  60. //xslObj = obj.responseText;
  61.  if (window.ActiveXObject)
  62. xslObj = obj.responseXML;
  63.  else
  64. xslObj = obj.responseText;
  65.  var xslTrans = createTranslate(xslObj);
  66.  sparse("div_srodek", xmlObj, xslTrans);
  67.  },
  68. onError : function(obj) { alert("Error: " + obj.status); }
  69. });
  70. },
  71. onError : function(obj) { alert("Error: " + obj.status); }
  72. });
  73. ?>


Wszytko pięknie działa w FF, ale IE już pluje błędem, tłumacząc na polski to co wypluło ie chodzi o to że plik xml nie jest poprawny lub arkusz xsl jest pusty nie pasuje do pliku.. jak jest niepoprawny jak działa! :/

edit: Uf, dokopałem się do rozwiązania, temat można skasować lub zostawić bo może się komuś przydać, otóż należało zastąpić
  1. <?php
  2. xslObj = obj.responseText;
  3. ?>
czymś takim:
  1. <?php
  2. if (window.ActiveXObject)
  3. xslObj = obj.responseXML;
  4. else
  5. xslObj = obj.responseText;
  6. ?>