Search
Web Braintrove
Site Navigation
Home
Products
Tags
Levels
Dates
Authors
5 MOST RECENT
Create Shared Rules
Perform a Case-Insensitive String Comparison without Using Translate()
Force a Field Value to a Boolean Using Rules
Quickly Crop to a Shadow
Sum Repeating Time Values
5 MOST POPULAR
Pass Query String Parameters to an ASP.NET Xml Control
Access a Method in a Master Page with Code-Behind
Prevent Namespace Prefixes from Being Copied to the Output
Create Groups in a Drop-Down List Box
Change the Default Action of the Power Button on the Windows Vista Start Menu
5 MOST FORGOTTEN
Recover a Dark Picture with a Heavy Color Cast
Hide Deleted Items in the Source Control Explorer
Prevent Windows Vista from Requesting Your Permission to Continue
Create a Variable with a Unique Sorted Node-Set
Get the Oldest or Newest Date Value of a List Node
Books
Programming Microsoft ASP.NET 2.0 Core Reference
Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter Kit
Expert ASP.NET 2.0 Advanced Application Design
Pro ASP.NET 2.0 in C# 2005
ASP.NET 2.0 Cookbook
Magazines
Visual Basic & Net Journal
Net Developers Journal
Inside Visual Basic
Soa Web Services Journal
Web Site Management And Internet Advertising Trends
DVDs
Programming Visual Basic .NET and ADO.NET with SQL Server and Access
Beginner's .NET XML Web Services 2004
Beginner's ASP.NET in C# 2003
Beginner's ASP.NET in VB.NET 2003
Visually Learn Visual Basic .NET in 12 Hours
Microsoft MVP
Very PopularMost Viewed
This article has been viewed 10870 times.

Pass Query String Parameters to an XSL Transform Using the ASP.NET Xml Control

Page 1 of 2
Written by Gregory Scot Collins
Friday, 19 May 2006, 5:19 PM
This article has been tested to work with the following products and versions. No guarantee of compatibility, with or without modification, is offered for products or versions other than those listed.
It is not inherently obvious when using the asp:Xml control how to pass parameters to your XSL transform. It can be done, but will require a small amount of coding to set the parameter values and add the parameter list to the control. To demonstrate this we will create three sample files: an ASPX page, an XML file, and an XSL file.
Because we will be using Active Server Pages, you will need access to a .NET enabled Web server. We will assume that you have one installed locally and that you will be testing this on http://localhost. If you are working with a remote server, substitute in your server name and any required path.

Create the sample XML file

Let's start by creating a very simple XML file to act as the source of our transform. Since we are demonstrating parameter passing we don't need to get fancy, so we will only require an empty root node. Copy the contents of Listing 1 into a text editor, and then save the file as ParamTest.xml.

Create the sample XSL file

Copy the contents of Listing 2 into a text editor, and then save the file as ParamTest.xsl. Be sure to save it in the same folder as the ParamTest.xml file.
This XSL receives two parameters, PARAM1 and PARAM2, and then either displays their value, or informs you that the value (which includes blank values) is not available.
Bookmark this Article
StumbleUpon  Stumble It!
Digg  Digg It!
del.icio.us  del.icio.us
List of Figures
Listing 1 - The ParamTest.xml file.
Listing 2 - The ParamTest.xsl file.
Listing 3 - The basics required to perform an XSL transform in ASP.NET.
Listing 4 - The ParamTest.aspx file.
Article Tags
Great Deals
TigerDirect Exclusive Deals, Limited Time Offers, Act Now And Save!
Find all current special offers on Adobe products.
Try SugarSync Free!
Join WebHost4Life.com
TigerDirect
Computers4SURE (4SURE.com - An Office Depot Co.)
Copyright © 2006-2010 Braintrove. All rights reserved. Braintrove, braintrove.com, and the Braintrove logo are trademarks of Gregory Scot Collins in the United States and/or other countries. The names of actual companies and products mentioned herein may be the trademarks of their respective owners. Any rights not expressly granted herein are reserved.