Bonjour,
Je développe une application qui comporte des traitements cotés clients dont certains utilisent une fonction que j'ai codé et qui est chargé de transformer un fichier xml grâce à un autre fichier xsl.

Du coté de firefox la transformation s'effectue sans accroc.
Mais du coté de ie j'ai un problème du fait du traitement asynchrone du processeur xsl . En effet je ne sais pas comment attendre que le processeur est fini son traitement pour récupérer le résultat du output.
La fonction alerte me donne comme résultat un output divisé en plusieurs parties du fait de l'asynchronisme.

Voici le code source de ma fonction :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
 
function RecupXML(xslt,xml,maDiv,maFunc){	
    var OutputDiv = document.getElementById(maDiv);
    if (window.XSLTProcessor){
        // Firefox, Opera 8.0+, Safari
		var oHTTP = null;
        oHTTP = new XMLHttpRequest();
        oHTTP.open( 'POST' , xslt , true );    
        oHTTP.onreadystatechange = function(){	
            if( oHTTP.readyState == 4 ){
                var XSLDoc = oHTTP.responseXML;
                if( XSLDoc == null ){
                    var xmlstring = oHTTP.responseText;
                    XSLDoc = ( new DOMParser() ).parseFromString( xmlstring , "text/xml" );
                }
                oHTTP.open( 'POST', xml , true );
                oHTTP.onreadystatechange = function(){
                    if( oHTTP.readyState == 4 ){                
                        var XMLDoc = oHTTP.responseXML;
                        if( XMLDoc == null ){
							var xmlstring = oHTTP.responseText;
                            XMLDoc = ( new DOMParser() ).parseFromString( xmlstring, "text/xml" );
                        }
                        var XSLProcessor = null;
                        XSLProcessor = new XSLTProcessor();
                        XSLProcessor.importStylesheet( XSLDoc );
                        var html = XSLProcessor.transformToFragment( XMLDoc, document );
                        html = ( new XMLSerializer() ).serializeToString( html );
                        OutputDiv.innerHTML = html ;
						if( maFunc != "" ) eval( maFunc );                                                
                    }
                }
                oHTTP.send('');
            }       
        }	
        oHTTP.send('');
    }
    // IE6.0 +
    else if(window.ActiveXObject)
    {  
	var XMLDoc = null;         
	var XSLDoc = null;	   
	var XSLProcessor = null;
	var XSLTemplate; 		
        XSLDoc = new ActiveXObject( "MSXML2.FreeThreadedDOMDocument.3.0" );
        XSLDoc.async = false;
        XSLDoc.load( xslt );
 
        XMLDoc = new ActiveXObject( "MSXML2.DOMDocument.3.0" );
        XMLDoc.onreadystatechange = ReadyStateChange;
        XMLDoc.async = true;
 
        XSLTemplate = new ActiveXObject( "MSXML2.XSLTemplate.3.0" );
        XSLTemplate.stylesheet = XSLDoc;		
        XSLProcessor = XSLTemplate.createProcessor();
        XSLProcessor.input = XMLDoc; 
        XMLDoc.load( xml );
 
        function ReadyStateChange(){
            if ( XMLDoc.readyState == 4 ){
				XSLProcessor.transform();			
				alert(XSLProcessor.readyState);
				alert(XSLProcessor.output);
				OutputDiv.innerHTML = XSLProcessor.output;
				if( maFunc != "" ) eval( maFunc );
			}			
		}
    }	
}
Voila , si quelqu'un a déjà rencontré le même problème je suis tout ouïe.
Si vous avez besoin de plus de renseignement ou avez des conseils à me donner je ne suis pas contre non plus!