Click to See Complete Forum and Search --> : Pull and Assign XSLT Parameter from ASPX Doc


kwilliams
10-20-2006, 11:36 AM
I've been able to pull and assign a XSLT parameter in ASP, but I'm now converting my site over to ASP.NET. I'm using XML, XSLT, ASP.NET, and VB.NET for this new site using the xslTransform method, and I want to pull an XSLT parameter into the ASP.NET page, and then assign a new value to that XSLT paramater using a form that's created from the XSLT stylesheet. This is what I have so far:

XSLT parameter
<xsl:param name="fname_value" select="''" />

ASP.NET code
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" AspCompat="true" Debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Web" %>
<%@ import Namespace="System.Web.UI" %>
<%@ import Namespace="System.Web.UI.WebControls" %>
<%@ import Namespace="System.Web.UI.HtmlControls" %>
<%@ import Namespace="System.Xml" %>
<%@ import Namespace="System.Xml.Xsl" %>
<%@ import Namespace="System.Xml.XPath" %>
<%@ import Namespace="System.IO" %>
<%@ Import Namespace="System.Text" %>
<script language="vb" runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

Dim xmlURL As String = "form.xml"
Dim xslURL As String = "form.xsl"

'Assign dynamic url for this page
xslTransform.DocumentSource = xmlURL
xslTransform.TransformSource = xslURL

End Sub
</script>
<html>
<body>
<asp:Xml id="xslTransform" runat="server"></asp:Xml>
</body>
</html>

I haven't found much on how to do this in ASP.NET, but I did find a great article from a book titled "XSLT and ASP.NET" at http://www.topxml.com/dotnet/articles/xslt/default.asp#.NET_Classes_Involved_in_Transforming_XML under the ".NET Classes Involved in Transforming XML" section. The book/article is written in C#, and I use VB.NET. But I'm using a C# to VB.NET converter at http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx to help out.

As far as I can see, this article doesn't have any examples involving pulling and assigning a value for an XSLT parameter using the method that I'm using, so I'm not sure where to go with this. So I'm looking for some direction on this subject. I'd appreciate any help. Thanks.