By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,294 Members | 2,588 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,294 IT Pros & Developers. It's quick & easy.

XML Transform - slower than molasses in January?

P: n/a
I am using the XML tranform functionality in .NET to transform data in
a DataSet into XMLSS using an XSLT file I have created.

There are about 100 columns and only about 120 rows in the data table
being transformed - modest amount of data to say the least.

The transform takes at least 10 seconds on a fast machine, which seems
absolutely ridiculous.

The DataSet contains many other tables in addition to the one I am
transforming; perhaps that is also having an impact. (The DataSet is
the result of a complex calculation engine, not database queries.)

Does anyone have any ideas on how I could improve performance of this
operation? Are transforms just doomed? I am tempted to write a routine
to simply output the exact XMLSS text from write statements... ugly,
but it would be very fast.
Nov 11 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Without having a complete (but minimal, please) example it is not possible
to say what is the problem with your code.

It may be that you have hit a wellknown problem with .Net xsltTransform when
using xsl:key and the key() function. Calculating generate-id() can also be
very slow, depending on the source.xml.

So, provide a code example (complete, but the minimal possible), then people
will be able to see and advise.
=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
"Luther Miller" <go********@hotmail.com> wrote in message
news:8c**************************@posting.google.c om...
I am using the XML tranform functionality in .NET to transform data in
a DataSet into XMLSS using an XSLT file I have created.

There are about 100 columns and only about 120 rows in the data table
being transformed - modest amount of data to say the least.

The transform takes at least 10 seconds on a fast machine, which seems
absolutely ridiculous.

The DataSet contains many other tables in addition to the one I am
transforming; perhaps that is also having an impact. (The DataSet is
the result of a complex calculation engine, not database queries.)

Does anyone have any ideas on how I could improve performance of this
operation? Are transforms just doomed? I am tempted to write a routine
to simply output the exact XMLSS text from write statements... ugly,
but it would be very fast.

Nov 11 '05 #2

P: n/a
Luther,

This is a known issue. Have you checked the archives of this group [0] and
the Microsoft Knowledge base [1]
--
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor

[0] http://groups.google.com/groups?selm...%40tkmsftngp12
[1] http://support.microsoft.com

"Luther Miller" <go********@hotmail.com> wrote in message
news:8c**************************@posting.google.c om...
I am using the XML tranform functionality in .NET to transform data in
a DataSet into XMLSS using an XSLT file I have created.

There are about 100 columns and only about 120 rows in the data table
being transformed - modest amount of data to say the least.

The transform takes at least 10 seconds on a fast machine, which seems
absolutely ridiculous.

The DataSet contains many other tables in addition to the one I am
transforming; perhaps that is also having an impact. (The DataSet is
the result of a complex calculation engine, not database queries.)

Does anyone have any ideas on how I could improve performance of this
operation? Are transforms just doomed? I am tempted to write a routine
to simply output the exact XMLSS text from write statements... ugly,
but it would be very fast.

Nov 11 '05 #3

P: n/a
There are also known issues with the XmlDataDocument.

Are you using this document as the source?

Joe Feser
"Luther Miller" <go********@hotmail.com> wrote in message
news:8c**************************@posting.google.c om...
I am using the XML tranform functionality in .NET to transform data in
a DataSet into XMLSS using an XSLT file I have created.

There are about 100 columns and only about 120 rows in the data table
being transformed - modest amount of data to say the least.

The transform takes at least 10 seconds on a fast machine, which seems
absolutely ridiculous.

The DataSet contains many other tables in addition to the one I am
transforming; perhaps that is also having an impact. (The DataSet is
the result of a complex calculation engine, not database queries.)

Does anyone have any ideas on how I could improve performance of this
operation? Are transforms just doomed? I am tempted to write a routine
to simply output the exact XMLSS text from write statements... ugly,
but it would be very fast.

Nov 11 '05 #4

P: n/a
Hi, thanks for the response. Here some code that will be helpful,
perhaps. Note that I am not using xsl:key or generate-id(), as far as
I know.

Note that the DataSet ds has quite a bit of data and the XML output
comes close to 3MB on disk. Only a fraction of this output is relevant
to the current XSLT, although I plan to add more to the XSLT to output
more components of the DataSet if I can get the performance issues
worked out. Must I convert the DataSet to an XmlDataDocument first?

C# CODE:
--------
XmlDataDocument xmlDoc = new XmlDataDocument(ds);
XslTransform xslTran = new XslTransform();
xslTran.Load(transform);
//context.Server.MapPath("transform.xslt"));
xslTran.Transform(xmlDoc, null, outputStream);

I will trim down the XSLT to show some examples from the file...

XSLT:
--------
<xsl:stylesheet version="1.0"
xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="urn:my-scripts"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" >

<xsl:template match="MyDataSet">

<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author> </Author>
<LastAuthor> </LastAuthor>
<Created>2003-10-09T20:23:45Z</Created>
....

<Worksheet ss:Name="SomeDataTable">
<Table ss:ExpandedColumnCount="256" ss:StyleID="s21" >
<xsl:attribute name="ss:ExpandedRowCount" >
<xsl:value-of select="count(SomeDataTable)+10"/>
</xsl:attribute>

<Column ss:StyleID="s21" ss:Width="97.5"/>
<Column ss:StyleID="s21" ss:Width="80.25"/>
<Column ss:StyleID="s21" ss:Width="117.75"/>
<Column ss:StyleID="s21" ss:Width="167.25"/>
....
<xsl:apply-templates select="SomeDataTable"/>
....
</xsl:template>

<xsl:template match="HedgeSheets">
<Row>
<xsl:if test="Hedge"><Cell ss:Index="1" ss:StyleID="Default"><Data
ss:Type="String"><xsl:value-of select="Hedge"/></Data></Cell></xsl:if>

<xsl:if test="SomeFlag"><Cell ss:Index="2" ss:StyleID="Default"><Data
ss:Type="Boolean"><xsl:choose><xsl:when
test="SomeFlag='true'">1</xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose></Data></Cell></xsl:if>

....

<xsl:if test="SomeDate"><Cell ss:Index="5" ss:StyleID="s31"><Data
ss:Type="DateTime"><xsl:value-of
select="substring(SomeDate,1,27)"/></Data></Cell></xsl:if>

<xsl:if test="SomeDecimal"><Cell ss:Index="6" ss:StyleID="s32"><Data
ss:Type="Number"><xsl:value-of
select="SomeDecimal"/></Data></Cell></xsl:if>
....
There are exactly 80 columns and about 225 rows in this table. Note
that most of the columns can have Null values, thus the xsl:if
construct (ssxml requires that you leave out the entry of the data is
null); and I have to do some processing for the dates and the boolean
(see previous newsgroup posting by me on ssxml).

I will look into possible bugs or KB articles related to the
XmlDataDocument and the Transform.

I suppose I might be served well to copy the entire data table into
another dataset first, to reduce the size of the XmlDataDocument,
although this would not be my preferred solution, as I plan to
transform additional data from the set as well.

-Luther
"Dimitre Novatchev" <dn********@yahoo.com> wrote in message news:<bm************@ID-152440.news.uni-berlin.de>...
Without having a complete (but minimal, please) example it is not possible
to say what is the problem with your code.

It may be that you have hit a wellknown problem with .Net xsltTransform when
using xsl:key and the key() function. Calculating generate-id() can also be
very slow, depending on the source.xml.

So, provide a code example (complete, but the minimal possible), then people
will be able to see and advise.
=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

Nov 11 '05 #5

P: n/a
Yes, I am using XmlDataDocument -- I will check the KB. What are the
issues / alternatives?
"Joe Feser" <nn**@fesersoft.com> wrote in message news:<eY**************@TK2MSFTNGP12.phx.gbl>...
There are also known issues with the XmlDataDocument.

Are you using this document as the source?

Joe Feser
"Luther Miller" <go********@hotmail.com> wrote in message
news:8c**************************@posting.google.c om...
I am using the XML tranform functionality in .NET to transform data in
a DataSet into XMLSS using an XSLT file I have created.

There are about 100 columns and only about 120 rows in the data table
being transformed - modest amount of data to say the least.

The transform takes at least 10 seconds on a fast machine, which seems
absolutely ridiculous.

The DataSet contains many other tables in addition to the one I am
transforming; perhaps that is also having an impact. (The DataSet is
the result of a complex calculation engine, not database queries.)

Does anyone have any ideas on how I could improve performance of this
operation? Are transforms just doomed? I am tempted to write a routine
to simply output the exact XMLSS text from write statements... ugly,
but it would be very fast.

Nov 11 '05 #6

P: n/a
Use XPathDocument instead of XmlDataDocument

Apart from this there seems to be almost no reason in the provided code for
such inefficiency.

The only place where it seems for some kind of optimization is possible is:
<xsl:value-of select="count(SomeDataTable)+10"/>
which could take a long if SomeDataTable is huge.

=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
"Luther Miller" <go********@hotmail.com> wrote in message
news:8c**************************@posting.google.c om... Hi, thanks for the response. Here some code that will be helpful,
perhaps. Note that I am not using xsl:key or generate-id(), as far as
I know.

Note that the DataSet ds has quite a bit of data and the XML output
comes close to 3MB on disk. Only a fraction of this output is relevant
to the current XSLT, although I plan to add more to the XSLT to output
more components of the DataSet if I can get the performance issues
worked out. Must I convert the DataSet to an XmlDataDocument first?

C# CODE:
--------
XmlDataDocument xmlDoc = new XmlDataDocument(ds);
XslTransform xslTran = new XslTransform();
xslTran.Load(transform);
//context.Server.MapPath("transform.xslt"));
xslTran.Transform(xmlDoc, null, outputStream);

I will trim down the XSLT to show some examples from the file...

XSLT:
--------
<xsl:stylesheet version="1.0"
xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="urn:my-scripts"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" >

<xsl:template match="MyDataSet">

<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author> </Author>
<LastAuthor> </LastAuthor>
<Created>2003-10-09T20:23:45Z</Created>
...

<Worksheet ss:Name="SomeDataTable">
<Table ss:ExpandedColumnCount="256" ss:StyleID="s21" >
<xsl:attribute name="ss:ExpandedRowCount" >
<xsl:value-of select="count(SomeDataTable)+10"/>
</xsl:attribute>

<Column ss:StyleID="s21" ss:Width="97.5"/>
<Column ss:StyleID="s21" ss:Width="80.25"/>
<Column ss:StyleID="s21" ss:Width="117.75"/>
<Column ss:StyleID="s21" ss:Width="167.25"/>
...
<xsl:apply-templates select="SomeDataTable"/>
...
</xsl:template>

<xsl:template match="HedgeSheets">
<Row>
<xsl:if test="Hedge"><Cell ss:Index="1" ss:StyleID="Default"><Data
ss:Type="String"><xsl:value-of select="Hedge"/></Data></Cell></xsl:if>

<xsl:if test="SomeFlag"><Cell ss:Index="2" ss:StyleID="Default"><Data
ss:Type="Boolean"><xsl:choose><xsl:when
test="SomeFlag='true'">1</xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:cho
ose></Data></Cell></xsl:if>
...

<xsl:if test="SomeDate"><Cell ss:Index="5" ss:StyleID="s31"><Data
ss:Type="DateTime"><xsl:value-of
select="substring(SomeDate,1,27)"/></Data></Cell></xsl:if>

<xsl:if test="SomeDecimal"><Cell ss:Index="6" ss:StyleID="s32"><Data
ss:Type="Number"><xsl:value-of
select="SomeDecimal"/></Data></Cell></xsl:if>
...
There are exactly 80 columns and about 225 rows in this table. Note
that most of the columns can have Null values, thus the xsl:if
construct (ssxml requires that you leave out the entry of the data is
null); and I have to do some processing for the dates and the boolean
(see previous newsgroup posting by me on ssxml).

I will look into possible bugs or KB articles related to the
XmlDataDocument and the Transform.

I suppose I might be served well to copy the entire data table into
another dataset first, to reduce the size of the XmlDataDocument,
although this would not be my preferred solution, as I plan to
transform additional data from the set as well.

-Luther
"Dimitre Novatchev" <dn********@yahoo.com> wrote in message

news:<bm************@ID-152440.news.uni-berlin.de>...
Without having a complete (but minimal, please) example it is not possible to say what is the problem with your code.

It may be that you have hit a wellknown problem with .Net xsltTransform when using xsl:key and the key() function. Calculating generate-id() can also be very slow, depending on the source.xml.

So, provide a code example (complete, but the minimal possible), then people will be able to see and advise.
=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

Nov 11 '05 #7

P: n/a
Use XPathDocument instead of XmlDataDocument

I am not sure of the most efficient way to get the infro from the DataSet
into an XPathDocument, but I assume it's an XmlReader.

Joe

"Luther Miller" <go********@hotmail.com> wrote in message
news:8c**************************@posting.google.c om...
Yes, I am using XmlDataDocument -- I will check the KB. What are the
issues / alternatives?
"Joe Feser" <nn**@fesersoft.com> wrote in message

news:<eY**************@TK2MSFTNGP12.phx.gbl>...
There are also known issues with the XmlDataDocument.

Are you using this document as the source?

Joe Feser
"Luther Miller" <go********@hotmail.com> wrote in message
news:8c**************************@posting.google.c om...
I am using the XML tranform functionality in .NET to transform data in
a DataSet into XMLSS using an XSLT file I have created.

There are about 100 columns and only about 120 rows in the data table
being transformed - modest amount of data to say the least.

The transform takes at least 10 seconds on a fast machine, which seems
absolutely ridiculous.

The DataSet contains many other tables in addition to the one I am
transforming; perhaps that is also having an impact. (The DataSet is
the result of a complex calculation engine, not database queries.)

Does anyone have any ideas on how I could improve performance of this
operation? Are transforms just doomed? I am tempted to write a routine
to simply output the exact XMLSS text from write statements... ugly,
but it would be very fast.

Nov 11 '05 #8

P: n/a
Thanks to everyone who responded. I found the KB articles 325689 and
318580. Using XPathDocument instead of XmlDataDocument resolved the
issue, and I am a happy camper!

-Luther

INFO: Performance of XSLT Transformations in the .NET Framework

http://support.microsoft.com/default...b;en-us;325689

PRB: XSL Transformations with XmlDataDocument May Perform More Slowly
Than XPathDocument

http://support.microsoft.com/default...b;en-us;318580
Nov 11 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.