Article ID: 281099 - Last Review: November 22, 2005 - Revision: 4.3 How To Use Active Server Pages to Dynamically Generate XMLThis article was previously published under Q281099 SUMMARY
This article describes how to use Active Server Pages (ASP) to dynamically create eXtensible Markup Language (XML). The example uses an XSL style sheet to format the results. NOTE: The sample only works in XML-enabled browsers such as Microsoft Internet Explorer 5 or later. NOTE: The sample should be considered a starting point in learning and understanding how to output XML from ASP. MORE INFORMATIONWARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR
OWN RISK. Microsoft provides this code "as is" without warranty of any
kind, either express or implied, including but not limited to the implied
warranties of merchantability and/or fitness for a particular purpose.
ASP/XML ExampleThis article is divided into the following sections:
A System Data Source Name (DSN) provides a way for ASP pages and other data clients to interface with a database.NOTE: You have to be an administrator to create a System DSN.
To better view the XML data, create an XSL style sheet to format the data.
Because ASP can format data from a database in many ways, you can output XML from data that is found in the database.
In Internet Explorer, type http://localhost/WebData/xmltest.asp in the address bar. An HTML table with the information from the Customers table in the sample database appears. However, if you view the source code to the page, you see only the XML data that the ASP page generated. This occurs because Internet Explorer loads the XML data and then retrieves the XSL style sheet to format the output that actually appears.In addition, both the XML data and the XSL style sheet are generic in design to allow easy data customization. For example, you could modify the SQL text as follows: REFERENCES
For more information on XML and XSL, see the following World Wide Web Consortium (W3C) Web site:
http://www.w3.org/
(http://www.w3.org/)
See also the XML and XSL online documentation on the Microsoft Developer Network (MSDN):
http://msdn.microsoft.com/
(http://msdn.microsoft.com/)
For additional information about how to use client-side data binding to generate XML, click the article number below
to view the article in the Microsoft Knowledge Base:
258295
(http://support.microsoft.com/kb/258295/EN-US/
)
How To Bind to XML Data with Internet Explorer
For additional information about XML and XSL, click the article numbers below
to view the articles in the Microsoft Knowledge Base:
264665
(http://support.microsoft.com/kb/264665/EN-US/
)
How To Display HTML in XSL Style Sheet
272270
(http://support.microsoft.com/kb/272270/EN-US/
)
How To Retrieve XML Data in ASP with the XML OLE-DB Simple Provider
| Article Translations
|

Back to the top
