Search
Web Braintrove
Site Navigation
Home
Products
Tags
Levels
Dates
Authors
5 MOST RECENT
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
Preview and Open Forms after Upgrading to Internet Explorer 8
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
Install Windows 7 Beta onto a Virtual Machine
Configure Lab Color Mode Defaults for Braintrove Articles
Permanently Change the Default Styles for New Word Documents
Enable Themes in Windows Server
Use Logical Operators in Place of Conditional Expressions
Books
Microsoft .NET Compact Framework
ASP.NET 2.0: A Developer's Notebook
Visual Studio .NET Tips and Tricks
Microsoft Visual Basic .Net Deluxe Learning Edition: Version 2003: Step by Step
Murach's ASP.NET 2.0 Upgrader's Guide: C# Edition
Magazines
Visual Basic & Net Journal
Inside Visual Basic
Web Site Management And Internet Advertising Trends
Visual Studio Magazine
SQL Server Magazine
DVDs
Beginner's ASP.NET in VB.NET 2003
Visually Learn Visual Basic .NET in 12 Hours
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
Microsoft MVP
Very PopularMost Viewed
This article has been viewed 10786 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.