[ Run Sample ]
Displaying XML documents in web pages is a task that web developers perform on a regular basis. Using the XML web server control in ASP.NET 2.0 makes displaying XML data enjoyable. You can easily load different XSLT style sheets to show the same XML file in different ways.
This example uses a web page that contains both a DropDownList and an XML web server control to display an XML file (Authors.xml) using one of three different XSLT style sheets. When a selection is made from the DropDownList the SelectedIndexChanged event fires and the XML control's TransformSource property is set to the proper XSLT style sheet for the selected view.
There are three views to choose from:
- Authors Phone List Blue (Authors1.xslt)
- Authors Address List (Authors2.xslt)
- Authors Phone List Green (Authors3.xslt)
All of the views display the Authors.xml file in a different format. The only difference between the two phone lists is the back ground color.
The source code can also be viewed on the sample page. Hopefully this example will give you some ideas on how to display XML files using the ASP.NET XML web server control.
Web开发者常需在网页展示XML文档,ASP.NET 2.0的XML Web服务器控件让展示XML数据更轻松。示例用含下拉列表和XML控件的网页,通过三种不同XSLT样式表展示XML文件,选择不同选项会触发事件并设置样式表,各视图格式不同。
8569

被折叠的 条评论
为什么被折叠?



