I have a program that outputs reports in HTML format. On average, they are about 5-10 MB, but I have seen extreme cases when they are 500 MB. These reports are purely client, the server is not involved here.
The problem is that the browser will hang until all the content has been downloaded, and sometimes it will not even load the content. I am trying to find a solution when someone who opens a report can always open it. People who open reports should be able to open them using a browser and any technology available in it.
I came up with a solution that would open a report that was previously 100MB, having our XML program output, and then convert it to HTML using XSLT, but the user still needs to wait until everything needs to be loaded into memory. All the content is inside these difference nodes, loaded into 2 rows of the table, and their order does not matter.
XML:
<diff> <parent loc="some string"/> <right> content</right> <left> content </left> </diff>
XSLT to do this conversion is below:
<xsl:for-each select="./diff"> <table align="center" border="1px" width="602"> <tbody> <tr> <td colspan="2"><xsl:value-of select="./parent/@loc"/></td> </tr> <tr> <td width="50%" align="left"> <xsl:if test="./left/text()"> <xsl:value-of select="./left/text()"/> </xsl:if> <xsl:if test="not(./left/text())"> <xsl:variable name="left"> <xsl:apply-templates select="./left/*" mode="serialize"/> </xsl:variable> <xsl:value-of select="$left"/> </xsl:if> </td> <td width="50%" align="right"> <xsl:if test="./right/text()"> <xsl:value-of select="./right/text()"/> </xsl:if> <xsl:if test="not(./right/text())"> <xsl:variable name="right"> <xsl:apply-templates select="./right/*" mode="serialize"/> </xsl:variable> <xsl:value-of select="$right"/> </xsl:if> </td> </tr> </tbody> </table> </xsl:for-each>
I am wondering if there is a way to load the file faster or not wait for the entire table to load into memory before displaying the page.
I donโt want to download the javascript library for this, since we donโt want to worry about connecting when viewing these reports and donโt want to install a bunch of files on all machines, but I can use some script inside xslt.
I know this is a strange scenario, and this is not an ideal way to structure the application, but we donโt have time to change the way these reports are generated.