Create an MSXML test environment

Source: Internet
Author: User
Generally, Windows (Windows 98SE or a later version) has an MSXML environment. the following asp code can be run, but it does not necessarily work. it may be because the style is http://www.w3.org/5o/form/transform, and the initial environment only supports http://ww.

Generally, Windows 98 SE and later versions have an MSXML environment. the following asp code can be run, but it does not necessarily work. it may be because the style sheet is disabled.

Reference content is as follows:

<% @ LANGUAGE = JScript %>
<%
// Set the source and style sheet locations here
Var sourceFile = Server. MapPath ("test. xml ");
Var styleFile = Server. MapPath ("test. xsl ");

 

// Load the XML
Var source = Server. CreateObject ("Microsoft. XMLDOM ");
Source. async = false;
Source. load (sourceFile );
// Load the XSL
Var style = Server. CreateObject ("Microsoft. XMLDOM ");
Style. async = false;
Style. load (styleFile );
Response. Write (source. transformNode (style ));
%>

 

Generally, MSXML is used as the development environment to create and install a new parser, such as MSXML 3 or MSXML 4 Technology Preview. after MSXML 3 is installed in the replace method, we can apply the following code:

Reference content is as follows:

<% @ LANGUAGE = JScript %>
<%
// Set the source and style sheet locations here
Var sourceFile = Server. MapPath ("test. xml ");
Var styleFile = Server. MapPath ("test. xsl ");

 

// Load the XML
Var source = Server. CreateObject ("Msxml2.DOMDocument ");
Source. async = false;
Source. load (sourceFile );
// Load the XSL
Var style = Server. CreateObject ("Msxml2.DOMDocument ");
Style. async = false;
Style. load (styleFile );
Response. Write (source. transformNode (style ));
%>

In this way, we get the development environment of MSXML 3, but if we don't want to damage the original environment, we have to test our example based on MSXML 3, although the replace method provides backward compatible methods to support XSL elements, functions, and XSL namespaces.

The actual application version has nothing to do with progIDs (version-dependent progIDs) to create an object instance can better complete the work, we do not need to use the replace method to install, use the side-by-side method, let's look at the following code:

Reference content is as follows:

<% @ LANGUAGE = JScript %>
<%
// Set the source and style sheet locations here
Var sourceFile = Server. MapPath ("test. xml ");
Var styleFile = Server. MapPath ("test. xsl ");

 

// Load the XML
Var source = Server. CreateObject ("Msxml2.DOMDocument. 3.0 ");
Source. async = false;
Source. load (sourceFile );
// Load the XSL
Var style = Server. CreateObject ("Msxml2.DOMDocument. 3.0 ");
Style. async = false;
Style. load (styleFile );
Response. Write (source. transformNode (style ));
%>

You only need to add version 3.0 to Msxml2.DOMDocument to apply MSXML 3, MSXML 4, and so on.

The same is true in the customer's real environment. The same is true for DOM objects created using js.

Reference content is as follows:
Function test (){
Var xmlDoc = new ActiveXObject ("Msxml2.DOMDocument. 3.0 ");
Var currNode;
XmlDoc. async = false;
XmlDoc. load ("test. xml ");
CurrNode = xmlDoc.doc umentElement. firstChild;
Alert (currNode. xml );
}

At last, the single side-by-side method of XSLT style is not supported in Internet Explorer 5.0 and later versions. If you want to apply IE 5 to open the XSLT style sheet, you need to install it using the replace method.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.