XSLT存档  

不及格的程序员-八神

 查看分类:  ASP.NET XML/XSLT JavaScripT   我的MSN空间Blog
星期二 天气:晴
 
昨天燕子 自己去五爱了 给我买了一堆袜子 给妈买了一双鞋
给自己买了一件 红色的内衣服 挺好看的
在市场买了一碗麻辣烫 买了二斤香樵 
  一般是用在多线程中的,不过现在好像用不到了这种对象了 除非你还在用asp来写后台程序、或者用
vb、vc之类com组件编程。
function Test(){
    var xmlDom = new ActiveXObject("Msxml2.DOMDocument");
    xmlDom.async = false;
    xmlDom.loadXML(...);

     if(xmlDom.parseError.errorCode != 0){
     var myErr = xmlDom.parseError;
     alert("XML 加载错误: " + myErr.reason);
    }else{
     var xslt = new ActiveXObject("Msxml2.XSLTemplate");
     var xsltDom = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");
     xsltDom.async = false;
     xsltDom.load("??.xslt");
     
     if(xsltDom.parseError.errorCode != 0) {
      var myErr = xsltDom.parseError;
      alert("XSLT 加载错误: " + myErr.reason);
     }else{
      xslt.stylesheet = xsltDom;
      var xslProc = xslt.createProcessor();
      xslProc.input = xmlDom;
      xslProc.transform();
      var openWin = window.open("about:blank","mans","toolbar=no,location=no,menubar=no,scrollbars=yes,left=100,top=100,width=250");
      try{
       openWin.document.writeln(xslProc.output);
      }catch(ex){
      }
     }
    }    
   }

 

Choosing a Threading Model

There are two versions of the XML control.

rental model
The rental model version is designed for single-threaded access. To use the rental model control, use the "Microsoft.DOMDocument" progID.
free-threaded model
The free-threaded version is designed for multiple thread access. To use the free-threaded control, use the "Microsoft.FreeThreadedDOMDocument" progID.

If you plan for several threads to access your XML data from a single control, be sure to use the free-threaded control. If only one thread will access the XML data, use the rental model control for better performance.

The following is a sample global.asa file that creates session-level and application-level free-threaded versions of the XML control.

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
  Sub Session_OnStart
    ON error RESUME next
     
    SET Application("AppFXMLdoc") = _
      server.CreateObject("MSXML2.FreeThreadedDOMDocument")
    SET Session("SessFXMLdoc") = _
      server.CreateObject("MSXML2.FreeThreadedDOMDocument")
  End Sub
  Sub Session_OnEnd
    ON error RESUME next
      
    SET Session("SessFXMLdoc") = nothing
    SET Application("AppFXMLdoc") = nothing
    Session("SessFXMLdoc") = empty
    Application("AppFXMLdoc") = empty
  End Sub
</SCRIPT>

Scripts accessing the Session and Application objects will be able to simultaneously access the "AppFXMLdoc" and "SessFXMLdoc" objects.

posted on 2015-05-14 20:49  不及格的程序员-八神  阅读(251)  评论(0编辑  收藏  举报