473,325 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Error in output from transformation when output exceeds 16040 byte

I have written an XSLT transformation on an ASP.NET page. The resulting HTML
is primarily a table of links. I have found that when the resulting HTML is
less than or equal to 16040 bytes, the output display is normal, but when the
resulting HTML exceeds 16040 bytes, the output does not display correctly.
When I look at View Source, I see that the final </html> tag gets moved to
another spot in the output, byte by byte as I increase the size, that is, at
16041 bytes, the final > gets moved, at 16042 bytes the final l> get moved,
etc. And as the output size increases, more and more of the "final"
characters get moved to another spot in the output.

Can anyone else replicate this problem? Is there a workaround?

I am running .NET Framework 1.1 and Windows XP Professional.

Here's the code I am running:

<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Xml.XPath" %>
<%@ Import Namespace="System.Xml.Xsl" %>

<script runat="server" >
void Page_Load(Object Sender, EventArgs E)
{
XslTransform xslDoc = new XslTransform();
StringBuilder sb = new StringBuilder(40000);
StringWriter sw = new StringWriter(sb);
lblMessage1.Text = sb.Capacity.ToString() + ' ' + sb.Length.ToString();

try
{
XPathDocument xmlDoc = new
XPathDocument(Server.MapPath("/GenDat/Moors.xml"));
xslDoc.Load(Server.MapPath("/GenDat/GenDat.xsl"));
xslDoc.Transform(xmlDoc,null,sw);
lblMessage1.Text = lblMessage1.Text + ' ' + sb.Capacity.ToString() + '
' + sb.Length.ToString();
}
catch(Exception ex)
{
lblMessage1.Text = ex.Message;
}
finally
{
sw.Close();
}

lblMessage2.Text = sb.ToString();
}
</script>

<html><body>
<asp:Label id="lblMessage1" runat="server" />
<asp:Label id="lblMessage2" runat="server" />
</body></html>

I have the same problem with the display of the output when I use the
following alternate code:

<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Xml.XPath" %>
<%@ Import Namespace="System.Xml.Xsl" %>

<html>
<body>
<asp:Xml id="xslTransform" runat="server"
DocumentSource="/Gendat/Moors.xml"
TransformSource="/Gendat/GenDat.xsl" />
</body>
</html>

Nov 12 '05 #1
3 1510
Joseph A Romeo wrote:
I have written an XSLT transformation on an ASP.NET page. The resulting HTML
is primarily a table of links. I have found that when the resulting HTML is
less than or equal to 16040 bytes, the output display is normal, but when the
resulting HTML exceeds 16040 bytes, the output does not display correctly.
When I look at View Source, I see that the final </html> tag gets moved to
another spot in the output, byte by byte as I increase the size, that is, at
16041 bytes, the final > gets moved, at 16042 bytes the final l> get moved,
etc. And as the output size increases, more and more of the "final"
characters get moved to another spot in the output.


That sounds weird. Can you provide some repro? Show us your XML and
stylesheet.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #2

"Oleg Tkachenko [MVP]" wrote:
That sounds weird. Can you provide some repro? Show us your XML and
stylesheet.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com


The original XML file was 2M, a bit large to include here. I have made an
abbreviated XML file and an abbreviated XSLT file which produce the same
problem as I reported. When the XML file contains the records with
type="test", the problem is noticeable; without them, it displays fine.

Moors.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE GenDat SYSTEM "GenDat.dtd" >

<GenDat>

<Family type="principal">Argo</Family>
<Family type="principal">Beckett</Family>
<Family type="principal">Cambridge</Family>
<Family type="principal">Carney</Family>
<Family type="principal">Carter</Family>
<Family type="principal">Clark</Family>
<Family type="principal">Coker</Family>
<Family type="principal">Cork</Family>
<Family type="principal">Cott</Family>
<Family type="principal">Counselor</Family>
<Family type="principal">Dean</Family>
<Family type="principal">Drain</Family>
<Family type="principal">Driggus</Family>
<Family type="principal">Durham</Family>
<Family type="principal">Farmer</Family>
<Family type="principal">Green</Family>
<Family type="principal">Greenage</Family>
<Family type="principal">Hansor</Family>
<Family type="principal">Hargrove</Family>
<Family type="principal">Harmon</Family>
<Family type="principal">Hughes</Family>
<Family type="principal">Johnson</Family>
<Family type="principal">Keys</Family>
<Family type="principal">LeCount</Family>
<Family type="principal">Loatman</Family>
<Family type="principal">Miller</Family>
<Family type="principal">Morgan</Family>
<Family type="principal">Morris</Family>
<Family type="principal">Mosley</Family>
<Family type="principal">Munce</Family>
<Family type="principal">Norwood</Family>
<Family type="principal">Oney</Family>
<Family type="principal">Perkins</Family>
<Family type="principal">Pickerem</Family>
<Family type="principal">Ridgeway</Family>
<Family type="principal">Sammons</Family>
<Family type="principal">Sanders</Family>
<Family type="principal">Seeney</Family>
<Family type="principal">Sisco</Family>
<Family type="principal">Sockum</Family>
<Family type="principal">Songo</Family>
<Family type="principal">Street</Family>
<Family type="principal">Wilson</Family>
<Family type="principal">Wright</Family>
<Family type="principal">(-----)</Family>

<Family type="related">Aldrich</Family>
<Family type="related">Anderson</Family>
<Family type="related">Appo</Family>
<Family type="related">Baker</Family>
<Family type="related">Ball</Family>
<Family type="related">Bannister</Family>
<Family type="related">Barr</Family>
<Family type="related">Berkheiser</Family>
<Family type="related">Blair</Family>
<Family type="related">Blunt</Family>
<Family type="related">Bolivar</Family>
<Family type="related">Bordley</Family>
<Family type="related">Borteles</Family>
<Family type="related">Bowers</Family>
<Family type="related">Bowles</Family>
<Family type="related">Briant</Family>
<Family type="related">Bridge</Family>
<Family type="related">Brooks</Family>
<Family type="related">Brown</Family>
<Family type="related">Buckley</Family>
<Family type="related">Burr</Family>
<Family type="related">Burrell</Family>
<Family type="related">Chambers</Family>
<Family type="related">Cook</Family>
<Family type="related">Coombs</Family>
<Family type="related">Cooper</Family>
<Family type="related">Coward</Family>
<Family type="related">Cuff</Family>
<Family type="related">Custis</Family>
<Family type="related">Davis</Family>
<Family type="related">Dawson</Family>
<Family type="related">Derry</Family>
<Family type="related">Dorsey</Family>
<Family type="related">Downs</Family>
<Family type="related">Ensign</Family>
<Family type="related">Fargo</Family>
<Family type="related">Faulkner</Family>
<Family type="related">Ferguson</Family>
<Family type="related">Fetters</Family>
<Family type="related">Finley</Family>
<Family type="related">Flowers</Family>
<Family type="related">French</Family>
<Family type="related">Galloway</Family>
<Family type="related">Garrettson</Family>
<Family type="related">Gates</Family>
<Family type="related">Gibbons</Family>
<Family type="related">Giboo</Family>
<Family type="related">Gibson</Family>
<Family type="related">Giffen</Family>
<Family type="related">Gilbert</Family>
<Family type="related">Gould</Family>
<Family type="related">Gray</Family>
<Family type="related">Gross</Family>
<Family type="related">Gullin</Family>
<Family type="related">Hale</Family>
<Family type="related">Hall</Family>
<Family type="related">Haskins</Family>
<Family type="related">Heard</Family>
<Family type="related">Hembsley</Family>
<Family type="related">Heywood</Family>
<Family type="related">Hider</Family>
<Family type="related">Highgate</Family>
<Family type="related">Hobart</Family>
<Family type="related">Hoffman</Family>
<Family type="related">Hogans</Family>
<Family type="related">Holmes</Family>
<Family type="related">Holston</Family>
<Family type="related">Horn</Family>
<Family type="related">Horton</Family>
<Family type="related">Hutchison</Family>
<Family type="related">Jacklin</Family>
<Family type="related">Jackson</Family>
<Family type="related">Jamison</Family>
<Family type="related">Jennifer</Family>
<Family type="related">Jones</Family>
<Family type="related">Kelly</Family>
<Family type="related">Kern</Family>
<Family type="related">Kelson</Family>
<Family type="related">King</Family>
<Family type="related">Kitridge</Family>
<Family type="related">Klick</Family>
<Family type="related">Krouse</Family>
<Family type="related">Linderman</Family>
<Family type="related">Lulham</Family>
<Family type="related">McCreary</Family>
<Family type="related">Mann</Family>
<Family type="related">Martin</Family>
<Family type="related">Maslin</Family>
<Family type="related">Mette</Family>
<Family type="related">Norfolk</Family>
<Family type="related">Okonski</Family>
<Family type="related">Omans</Family>
<Family type="related">Osterhout</Family>
<Family type="related">Owens</Family>
<Family type="related">Parelli</Family>
<Family type="related">Parrish</Family>
<Family type="related">Patterson</Family>
<Family type="related">Payne</Family>
<Family type="related">Phelps</Family>
<Family type="related">Pierce</Family>
<Family type="related">Pounder</Family>
<Family type="related">Pritchett</Family>
<Family type="related">Proctor</Family>
<Family type="related">Reddick</Family>
<Family type="related">Reed</Family>
<Family type="related">Renton</Family>
<Family type="related">Reynolds</Family>
<Family type="related">Ricks</Family>
<Family type="related">Robbins</Family>
<Family type="related">Rodgers</Family>
<Family type="related">Ross</Family>
<Family type="related">Rothermel</Family>
<Family type="related">Rush</Family>
<Family type="related">Russell</Family>
<Family type="related">Schaefer</Family>
<Family type="related">Schramm</Family>
<Family type="related">Schultz</Family>
<Family type="related">Shaw</Family>
<Family type="related">Smith</Family>
<Family type="related">Spaulding</Family>
<Family type="related">Spotts</Family>
<Family type="related">Stith</Family>
<Family type="related">Stone</Family>
<Family type="related">Thomas</Family>
<Family type="related">Thompson</Family>
<Family type="related">Valentino</Family>
<Family type="related">Voshell</Family>
<Family type="related">Wapker</Family>
<Family type="related">Waples</Family>
<Family type="related">Way</Family>
<Family type="related">Webb</Family>
<Family type="related">Westcott</Family>
<Family type="related">Whitcraft</Family>
<Family type="related">Wielandt</Family>
<Family type="related">Williams</Family>
<Family type="related">Wood</Family>
<Family type="related">Young</Family>

<Family type="test">Test1</Family>
<Family type="test">Test2</Family>
<Family type="test">Test3</Family>
<Family type="test">Test4</Family>
<Family type="test">Test5</Family>
<Family type="test">Test6</Family>
<Family type="test">Test7</Family>
<Family type="test">Test8</Family>
<Family type="test">Test9</Family>
<Family type="test">Test10</Family>
<Family type="test">Test11</Family>
<Family type="test">Test12</Family>
<Family type="test">Test13</Family>
<Family type="test">Test14</Family>
<Family type="test">Test15</Family>
<Family type="test">Test16</Family>

</GenDat>

Gendat.xsl

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:variable name="Family" select="/GenDat/Family" />

<xsl:template match="/" >
<xsl:call-template name="FamilyTable" >
<xsl:with-param name="Type" select="'principal'" />
</xsl:call-template>
<xsl:call-template name="FamilyTable" >
<xsl:with-param name="Type" select="'related'" />
</xsl:call-template>
</xsl:template>

<xsl:template name="FamilyTable" >
<xsl:param name="Type" select="'None'" />
<xsl:variable name="Count" select="count($Family[@type=$Type])" />
<xsl:if test="$Count > 0" >
<h3>
<xsl:choose>
<xsl:when test="$Type = 'principal'">Principal </xsl:when>
<xsl:when test="$Type = 'related'">Related </xsl:when>
</xsl:choose>
<xsl:text>Families</xsl:text>
</h3>
<table width="100%">
<colgroup width="20%" valign="top" align="left"></colgroup>
<colgroup width="80%" valign="top" align="left"></colgroup>
<xsl:apply-templates select="$Family" />
</table>
</xsl:if>
</xsl:template>

<xsl:template match="Family" >
<tr>
<td>
<xsl:value-of select="@type" />
</td>
<td>
<xsl:value-of select="." />
</td>
</tr>
</xsl:template>

</xsl:stylesheet>

GenDat.dtd

<!ELEMENT GenDat (Family*) >
<!ELEMENT Family (#PCDATA) >
<!ATTLIST Family
type CDATA #IMPLIED >
Nov 12 '05 #3
After upgrading to .NET Framework 1.1 Service Pack 1, the transformation
works correctly.
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I...
4
by: Mike Conmackie | last post by:
Hi Folks, I've probably omitted something very basic but I have no idea what it might be. The results of my transformation _should_ be an xml file but all I get is the xml declaration...
1
by: KwiKiwi | last post by:
Hey, I'm doing a series of XSL Transformations from a C#.NET Console app. I've designed a .xsl file (to output to "text" not "xml") to generate a text file with entries that look like: ...
1
by: Tim Menninger | last post by:
When I use the XslTransform.Transform method to write to the HttpRequest.OutputStream The first byte of the output is always an invalid character, looks like an ascii zero or some other...
0
by: Joseph A Romeo | last post by:
I have written an XSLT transformation on an ASP.NET page. The resulting HTML is primarily a table of links. I have found that when the resulting HTML is less than or equal to 16040 bytes, the...
25
by: moondaddy | last post by:
I have an application where users need to upload images and in my web.config file I have a setting like this: <httpRuntime maxRequestLength="512" /> Which restricts image larger than 500k from...
6
by: Ken | last post by:
When running a program in the debugger, what would cause it to crash without any error messages? I get "The program has exited with code 0 (0x0)". The program is a MDI app with threading for...
0
by: debug03 | last post by:
I am executing a DTS package on a Windows 2000 sp4 server running SQL Server 2000 and IBM DB2 V7 client. The DTS package source data(SQL Server) is selected from SQL server table and inserts data to...
2
by: jthep | last post by:
I'm trying to get this piece of code I converted from C to work in C++ but I'm getting an access violation error. Problem occurs at line 61. Someone can help me with this? The function...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.