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?
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>