kwilliams
07-06-2007, 04:08 PM
My site uses a XML/XSL transformation using an ASP.NET page, and I'm trying to reset one of the XSL doc's parameters depending on a querystring value (ex: default.aspx?record_id=pw). But I'm getting an error, and I'm not sure how to solve it. This is what I have so far:
ASP.NET DOC
'Assign XML and XSLT docs
Dim strThisPage_xml As String = "/docs/xml/default.xml" 'XML doc string
Dim strThisPage_xsl As String = "/docs/xslt/default.xsl" 'XSLT doc string
'Declare querystring variable
Dim recordId_qs As String = Request.QueryString("record_id")
'Create the XsltArgumentList object
Dim args As New XsltArgumentList()
args.AddParam("record_id", "", recordId_qs)
'Assign maincolumn XML/XSLT transformation properties
xslTransform_mc.DocumentSource = strThisPage_xml
xslTransform_mc.TransformSource = strThisPage_xsl
xslTransform_mc.TransformArgumentList = args
RESULT:
ERROR:
System.ArgumentNullException: Value cannot be null.
Value cannot be null. Parameter name: parameter
And if I add the following code above the "Assign maincolumn XML/XSLT transformation properties" set of code, it works:
'Declare default querystring variables
If recordId_qs = "" Then
recordId_qs = "default"
End If
But I obviously know that this isn't the correct way to solve it. I read some stuff on how to dataset, but do I need to do the same for a string? Anyway, if you could point me in the right direction, that would be very helpful. Thanks.
ASP.NET DOC
'Assign XML and XSLT docs
Dim strThisPage_xml As String = "/docs/xml/default.xml" 'XML doc string
Dim strThisPage_xsl As String = "/docs/xslt/default.xsl" 'XSLT doc string
'Declare querystring variable
Dim recordId_qs As String = Request.QueryString("record_id")
'Create the XsltArgumentList object
Dim args As New XsltArgumentList()
args.AddParam("record_id", "", recordId_qs)
'Assign maincolumn XML/XSLT transformation properties
xslTransform_mc.DocumentSource = strThisPage_xml
xslTransform_mc.TransformSource = strThisPage_xsl
xslTransform_mc.TransformArgumentList = args
RESULT:
ERROR:
System.ArgumentNullException: Value cannot be null.
Value cannot be null. Parameter name: parameter
And if I add the following code above the "Assign maincolumn XML/XSLT transformation properties" set of code, it works:
'Declare default querystring variables
If recordId_qs = "" Then
recordId_qs = "default"
End If
But I obviously know that this isn't the correct way to solve it. I read some stuff on how to dataset, but do I need to do the same for a string? Anyway, if you could point me in the right direction, that would be very helpful. Thanks.