XSL Transform

K

Ken Simmons

I have having a problem when transforming. It is taking an unusually long
time to transform. Any tips?

Dim xmlDoc As System.Xml.XmlDataDocument = New
System.Xml.XmlDataDocument(dsClaimProcessing_SelectData)
Dim xslTran As System.Xml.Xsl.XslTransform = New System.Xml.Xsl.XslTransform
xslTran.Load("ClaimDSToXML.xslt")


Dim sClaimProcessingFormattedData As String
Dim NewMemoryStream As New System.IO.MemoryStream
'THIS LINE TAKES ABOUT 4min 30sec
xslTran.Transform(xmlDoc, Nothing, NewMemoryStream, Nothing)

NewMemoryStream.Position = 0
Dim trTextReader As New System.IO.StreamReader(NewMemoryStream)
sClaimProcessingFormattedData = trTextReader.ReadToEnd
 
F

Fergus Cooney

Hi Ken,

10MB of xml and 40K of complex xsl and 4m30s will be quick!!
I think it may be useful to know what your xml and xsl are? ;-)

Regards,
Fergus
 
K

Ken Simmons

The xml is 155k, but there is some logic in the xslt file. What I am doing
is taking a dataset and transforming it to the xml structure that I need it
to be. I just didn't know if there was something I was doing in the vb code
that was making it take longer than it should.
 
K

Ken Simmons

Also, If I save the dataset to a file and manually apply the stylesheet it
only takes a few seconds. That it what is leading me to believe that it is
something with the code I submitted.
 
F

Fergus Cooney

Hi Ken,

I'm still on the learning curve myself but the code looks pretty
straightforward.

One way to test it would be to put a reference in the xml file to the
stylesheet
and load it into Internet Explorer. See how long <it> takes to do the job. If
IE is
slow, too, then your xslt is the culprit. Are your XPaths as specific as
possible?
Do they do a lot of 'wild-card' searching, perhaps?

Could you post the xsl and a sample of the xml at all? I'd be interested
to see it.
If you'd like me to test it on my setup, feel free to email the lot direct to
me - xml,
xsl and project (cut-down a bit perhaps).

On the other hand, as I say, I'm still climbing the hill. There's an
excellent chap in
the xml newsgroup - microsoft.public.dotnet.xml.

Regards,
Fergus
 
K

Ken Simmons

I replaced this line....
Dim xmlDoc As System.Xml.XmlDataDocument = New
System.Xml.XmlDataDocument(dsClaimProcessing_SelectData)
with

Dim xmlDoc As New Xml.XmlDocument
xmlDoc.LoadXml(dsClaimProcessing_SelectData.GetXml)

and it went from 4 mins to 1 second
 
F

Fergus Cooney

Hi Ken,

Hot Dang!! :-D

Regards,
Fergus

Translation.
I'll be wary of XmlDataDocument. Thanks. :)
 

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

Top