Search
Web Braintrove
Site Navigation
Home
Products
Tags
Levels
Dates
Authors
5 MOST RECENT
Locate the Design Checker Task Pane in InfoPath 2010
Locate Conditional Formatting and Custom Validation in InfoPath 2010
Conditionally Display Different Values In a Single Expression Box
Create a Button With a Blank Label
Create Shared Rules
5 MOST POPULAR
Access a Method in a Master Page with Code-Behind
Pass Query String Parameters to an ASP.NET Xml Control
Prevent Namespace Prefixes from Being Copied to the Output
Create Groups in a Drop-Down List Box
Configure IIS 7 for Custom Error Pages
5 MOST FORGOTTEN
Install Windows 7 Beta onto a Virtual Machine
Group Dates by Year, Month and Day
Configure Lab Color Mode Defaults for Braintrove Articles
Create a Monochromatic Dream Text Effect Using Styles
Combine Multiple Sums Into a Single Function
Books
Test-Driven Development in Microsoft .NET
Murach's C# (.Net Developer)
ASP.NET 2.0: A Developer's Notebook
Programming Microsoft ASP.NET 2.0 Core Reference
Professional Ajax
Magazines
SQL Server Magazine
.net
Inside Visual Basic
Asp.netpro
Asp.net Professional
DVDs
Beginner's ASP.NET in VB.NET 2003
Programming Visual Basic .NET and ADO.NET with SQL Server and Access
Visually Learn Visual Basic .NET in 12 Hours
Beginner's ASP.NET in C# 2003
Beginner's .NET XML Web Services 2004
Microsoft MVP
Very PopularMost Viewed
This article has been viewed 12195 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.