xsl-list
[Top] [All Lists]

Problems with XSLT and Memory

2003-06-23 23:33:41
Hi there,

Well, before all, I'm spanish so I beg your pardon for my horrible english. I'm going to try to explain my problems the best I can.

I have designed and programmed a Report Generator Framework using XSLT to generate the HTML output from XML source. I have also a reflection module to generate this XML source from a Object ArrayList formed by classes with the data. To get the XML source I use a mix of java code (to get the data from the Object ArrayList and put it in generic Hashtable) and XSL to work with these Hashtables and to produce the XML.

All works properly and very quickly, but we have a problem when we work with a huge amount of Objects (for example 999). The Java Virtual Machine collapses and the system get down.

I got these Exceptions:

javax.servlet.ServletException: Servlet execution threw an exception

caused by

java.lang.StackOverflowError
at org.apache.xalan.serialize.SerializerToText.writeNormalizedChars(SerializerToText.java:385)


Anybody knows what`s going on ?

I'm using the XALAN library and the Tomcat Server embebed in the JBuilder 8 IDE, my XSL Stylesheet is this:

Thankx in advance and greetings from Spain !!!!

David Bonilla

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:fo="http://www.w3.org/1999/XSL/Format"; xmlns:report="java:com.ips.reports.Report" xmlns:hashtable="java:java.util.Hashtable" xmlns:enumeration="java:java.util.Enumeration" exclude-result-prefixes="report hashtable enumeration xsi fo">
        <xsl:output method="xml" encoding="ISO-8859-1"/>
        <xsl:param name="copyright" select="'www.ipsoluciones.com'"/>
        <xsl:param name="report"/>
        <xsl:template match="/">
<xsl:param name="conditionList" select="report:getConditionFields($report)"/> <xsl:param name="registerList" select="report:getReportRegisters($report)"/>
                <xsl:comment>
                        <xsl:value-of select="$copyright"/>
                </xsl:comment>
<report xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="C:\trabajo\varma\fuentes\xsd\report.xsd">
                        <reportUser>
                                <xsl:value-of 
select="report:getReportUser($report)"/>
                        </reportUser>
                        <reportDepartment>
                                <xsl:value-of 
select="report:getReportDepartment($report)"/>
                        </reportDepartment>
                        <reportDate>
                                <xsl:value-of 
select="report:getReportDate($report)"/>
                        </reportDate>
                        <conditions>
<xsl:variable name="conditionKey" select="report:auxGetLastConditionDescription($report)"/>
                                <xsl:call-template name="conditions">
                                        <xsl:with-param name="conditionKey" 
select="$conditionKey"/>
                                        <xsl:with-param name="conditionLista" 
select="$conditionList"/>
                                </xsl:call-template>
                        </conditions>
                        <elements>
<xsl:variable name="registerKey" select="report:auxGetLastRegisterKey($report)"/>
                                <xsl:call-template name="elements">
                                        <xsl:with-param name="registerKey" 
select="$registerKey"/>
                                        <xsl:with-param name="registerList" 
select="$registerList"/>
                                </xsl:call-template>
                        </elements>
                        <reportTotals>
                                <xsl:value-of 
select="report:geXMLReportTotals($report)"/>
                        </reportTotals>
                </report>
        </xsl:template>
        <!-- -Genera todos los nodos de condiciones de un informe -->
        <xsl:template name="conditions">
                <xsl:param name="conditionKey"/>
                <xsl:param name="conditionLista"/>
                <xsl:if test="boolean($conditionKey)">
                        <condition>
                                <xsl:attribute name="description">
                                        <xsl:value-of select="$conditionKey"/>
                                </xsl:attribute>
                                <xsl:attribute name="value">
                                        <xsl:value-of 
select="hashtable:get($conditionLista, $conditionKey)"/>
                                </xsl:attribute>
                        </condition>
                </xsl:if>
<xsl:variable name="conditionKeyI" select="report:auxGetLastConditionDescription($report)"/>
                <xsl:if test="boolean($conditionKey)">
                        <xsl:call-template name="conditions">
                                <xsl:with-param name="conditionKey" 
select="$conditionKeyI"/>
                                <xsl:with-param name="conditionLista" 
select="$conditionLista"/>
                        </xsl:call-template>
                </xsl:if>
        </xsl:template>
        <!-- -Genera todos los nodos de registros de un informe -->
        <xsl:template name="elements">
                <xsl:param name="registerKey"/>
                <xsl:param name="registerList"/>
                <xsl:if test="boolean($registerKey)">
<xsl:variable name="columnList" select="hashtable:get($registerList, $registerKey)"/> <xsl:value-of select="report:processRegisterToXML($report, $registerKey)"/>
                        <register>
<xsl:variable name="columnKey" select="report:auxGetLastColumnKey($report)"/>
                                <xsl:call-template name="columns">
                                        <xsl:with-param name="columnKey" 
select="$columnKey"/>
                                        <xsl:with-param name="columnList" 
select="$columnList"/>
                                </xsl:call-template>
                        </register>
<xsl:variable name="registerKey" select="report:auxGetLastRegisterKey($report)"/>
                        <xsl:choose>
                                <xsl:when test="boolean($registerKey)">
                                        <xsl:call-template name="elements">
                                                <xsl:with-param name="registerKey" 
select="$registerKey"/>
                                                <xsl:with-param name="registerList" 
select="$registerList"/>
                                        </xsl:call-template>
                                </xsl:when>
                                <xsl:otherwise>
<!-- Se llama al procesar registro por ultima vez para que muestre los totales de los cortes--> <xsl:value-of select="report:processRegisterToXML($report, $registerKey)"/>
                                </xsl:otherwise>
                        </xsl:choose>
                </xsl:if>
        </xsl:template>
        <!-- -Genera todos los nodos de columnas de un registro -->
        <xsl:template name="columns">
                <xsl:param name="columnKey"/>
                <xsl:param name="columnList"/>
                <xsl:if test="boolean($columnKey)">
                        <column>
<xsl:attribute name="columnID"><xsl:value-of select="$columnKey"/></xsl:attribute> <xsl:attribute name="value"><xsl:value-of select="hashtable:get($columnList, $columnKey)"/></xsl:attribute>
                        </column>
                </xsl:if>
<xsl:variable name="columnKey" select="report:auxGetLastColumnKey($report)"/>
                <xsl:if test="boolean($columnKey)">
                        <xsl:call-template name="columns">
                                <xsl:with-param name="columnKey" 
select="$columnKey"/>
                                <xsl:with-param name="columnList" 
select="$columnList"/>
                        </xsl:call-template>
                </xsl:if>
        </xsl:template>
</xsl:stylesheet>

_________________________________________________________________
Multiplica por cinco el tamaño de tu buzón de correo y envía adjuntos de hasta 2 Mb con MSN Almacenamiento Extra. http://join.msn.com/?pgmarket=es-es


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>