all groups > asp.net > march 2004 >
You're in the

asp.net

group:

XslTransform problem



XslTransform problem Ruprict
3/31/2004 8:35:52 PM
asp.net: I am trying to transform a dataset with xslt, and it continually fails
with a NullReference Exception after the transform when I try to read
the result into another dataset I have tested the XML and stylesheet,
so you can assume (ahem) that they are valid. I am using 1.1


The code is below:

Dim sre As System.IO.StringReader = New
System.IO.StringReader(ResultsDataSet.GetXml())

Dim xt As New XmlTextReader(sre)
Dim xp As New XmlDataDocument(ResultsDataSet)


Dim file As String = "/CMPDNet/support/xslt/"
If lyrName.ToLower = "reported incidents" Then
file += "IncidentsSummary.xsl"
Else
file += "CallSummary.xsl"
End If


Dim xslTran As New System.Xml.Xsl.XslTransform

xslTran.Load(Server.MapPath(file))
Dim resolver As XmlUrlResolver = New XmlUrlResolver
Dim xmlReader As XmlReader

xmlReader = xslTran.Transform(xp, Nothing, resolver)
Dim xmldoc As XmlDocument = New XmlDocument
xmldoc.Load(xmlReader)
SummaryDataSet.ReadXml(xmlReader) 'EXCEPTION HAPPENS HERE

Re: XslTransform problem Ruprict
4/1/2004 10:49:06 PM
Sorry...the problem was that I am stupid.

Didn't initialize the second dataset.

SummaryDataSet = new DataSet() fixed the problem



[quoted text, click to view]
AddThis Social Bookmark Button