Compartir a través de


XML Content in IIS

Extensible Markup Language (XML), like HTML, allows you to apply markup, in the form of tags, to a document. However, unlike HTML, XML is designed to be used as a generalized markup language. In other words, HTML is a markup language for displaying information, and XML is a markup language for organizing semantics and structure. If data is stored in XML files where the structure is enforced by a DTD, the data can be transformed into almost any other format including HTML and Word documents. This flexibility makes XML extremely powerful, and the possible range of applications is impressive.

Note

DTD files are not required, but recommended to enforce a specific structure. Stylesheets are required only to format XML data.

IIS treats an XML file the same way it treats an HTML file; as a static file. A client Web browser that receives an XML file displays raw XML unless it is transformed by an XSLT or sylesheet on the client or the server.

For more information on working with XML, refer to the XML section of the Platform SDK, and Beyond ASP: XML and XSL-based Solutions Simplify Your Data Presentation Layer. For more detailed information about XML and related standards, see the World Wide Web Consortium Web site.

Client-side Transformation of XML Files

By making the stylesheet publicly available on the Internet, the client Web browser is forced to perform transformation of a requested XML page. Internet Explorer (IE) has the ability to apply XML transformation but some Web browsers do not. IIS must be configured to add a MIME type for the XML and XSLT file extensions in the MimeMap metabase property.

IIS 5.1 and earlier: IIS serves static files even if their extension is not listed in the MimeMap metabase property.

The following XML code references the stylesheet over the Internet:

<?xml version="1.0"?> 
<?xml:stylesheet type="text/xsl" href="http://MyServer/MyStylesheet.xslt"?> 

Another method of performing XML transformation on the client is by using the MSXML transformNode method in client-side script.

For an example of using transformNode, see Transforming XML Content in IIS.

Server-side Transformation of XML Files

XML files can be loaded in a script or executable and then transformed using the MSXML transformNode method. This can be done in an ASP page, COM component, an ISAPI.

For an example of using transformNode, see Transforming XML Content in IIS.

Additionally, an ISAPI filter called XSLISAPI2.dll can perform XML transformation and is available on the Internet.