XslTransform problem

R

Ruprict

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

Any ideas?
 
R

Ruprict

Sorry...the problem was that I am stupid.

Didn't initialize the second dataset.

SummaryDataSet = new DataSet() fixed the problem
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top