470,819 Members | 1,596 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,819 developers. It's quick & easy.

how to pass parameters to xsl from my aspx file

I have an customerdetail.xsl sheet
----------------------------------------------------------
<?xml version="1.0" encoding="iso-8859-1"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:param name="customer_number"></xsl:param>

<xsl:template match="customerlist">
<html>
<body>
<table border="1" frame="box">
<xsl:for-each
select="mag_customer[@customer_number=$customer_number]">
<tr>
<TH>Customer</TH>
<td><xsl:value-of select="@customer"/></td>
</tr>
<tr>
<TH>Address</TH>
<td><xsl:value-of select="@address"/></td>
</tr>
<tr>
<TH>Telephone</TH>
<td><xsl:value-of select="@telephone"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

my customerdetail.aspx code is like this
---------------------------------------

<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="CustomerDetails.aspx.vb" Inherits="CustomerDetails" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
&nbsp;</div>
<asp:Xml ID="Xml1" runat="server"
DocumentSource="~/App_Data/customerlist.xml"
TransformSource="~/App_Data/customerdetail.xsl"></asp:Xml>
</form>
</body>
</html>
i also have customer.aspx file(witch will redirect to
customerdetails.aspx as long as user selected a customer number) and
inside i have the "customer_number" paramaters,my question is from
customer.aspx how do i pass the customer_number value to
cusomerdetails.aspx and further to the customerdetail.xsl?

thanks

May 15 '06 #1
3 1935
Wang Xiaoning wrote:
i also have customer.aspx file(witch will redirect to
customerdetails.aspx as long as user selected a customer number) and
inside i have the "customer_number" paramaters,my question is from
customer.aspx how do i pass the customer_number value to
cusomerdetails.aspx and further to the customerdetail.xsl?


You can pass parameters from aspx to aspx using various methods - from
Session to HTTP Request parameters. And you can pass parameters to XSLT
using TransformArgumentList property of the XML control.

--
Oleg Tkachenko [XML MVP, MCAD]
http://www.XmlLab.Net | http://www.XLinq.Net | http://blog.tkachenko.com
May 16 '06 #2
my customerdetails.aspx has this code

<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="CustomerDetails.aspx.vb" Inherits="CustomerDetails" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div></div>
<asp:Xml ID="Xml1" runat="server"
DocumentSource="~/App_Data/customerlist.xml"
TransformSource="~/App_Data/customerdetail.xsl"></asp:Xml>
&nbsp; &nbsp;
</form>

</body>
</html>
if i want to pass customer_number A00010 xsl, where do i put this code,
in page_load() ?

Dim xslArg As New System.Xml.Xsl.XsltArgumentList()
xslArg.AddParam("customer_number", "", "A00010")

May 16 '06 #3
i fond i forgot

Xml1.TransformArgumentList

after i have this, it works, thanks for the support.

May 16 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Zlatko Matić | last post: by
5 posts views Thread by Ben | last post: by
2 posts views Thread by Alex Nitulescu | last post: by
5 posts views Thread by Apollo0130 | last post: by
5 posts views Thread by slowmotiongenius | last post: by
2 posts views Thread by rn5a | last post: by
3 posts views Thread by Aussie Rules | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.