[xsl] stackOverflowError while doing generte-id and sum

Subject: [xsl] stackOverflowError while doing generte-id and sum
From: "Lee, Insoo" <Insoo.Lee@xxxxxx>
Date: Sun, 18 May 2003 13:27:40 -0400

 We are doing the grouping in order to establish the unique values for
currency and do grand total summation for following like xml..


<REPORT>
     <ENTITY NUMBER="1">
         <FUND_GROUP CURRENCY="GBP">
             <ROW>
                 <SOME_VALUE>100</SOME_VALUE>
             </ROW>
             <ROW>
                 <SOME_VALUE>200</SOME_VALUE>
             </ROW>
             <ROW>
                 <SOME_VALUE>300</SOME_VALUE>
             </ROW>
         </FUND_GROUP>

         <FUND_GROUP CURRENCY="USD">
             <ROW>
                 <SOME_VALUE>100</SOME_VALUE>
             </ROW>
             <ROW>
                 <SOME_VALUE>200</SOME_VALUE>
             </ROW>
             <ROW>
                 <SOME_VALUE>300</SOME_VALUE>
             </ROW>
         </FUND_GROUP>
     </ENTITY>

     <ENTITY NUMBER="2">
         <FUND_GROUP CURRENCY="GBP">
             <ROW>
                 <SOME_VALUE>100</SOME_VALUE>
             </ROW>
             <ROW>
                 <SOME_VALUE>200</SOME_VALUE>
             </ROW>
         </FUND_GROUP>

         <FUND_GROUP CURRENCY="USD">
             <ROW>
                 <SOME_VALUE>200</SOME_VALUE>
             </ROW>
             <ROW>
                 <SOME_VALUE>300</SOME_VALUE>
             </ROW>
         </FUND_GROUP>
     </ENTITY>

</REPORT>


and this xsl works well..



	<xsl:for-each select="$currencies">

                        <xsl:if test="generate-id(.)=
                            generate-id( $currencies[ @CURRENCY =
                                        current()/@CURRENCY ] )">

                    <tr>
                        <td align="left" width="23%"><b>Grand Total
(<xsl:value-of select="@CURRENCY"/>):</b></td>
                        <td align="right"
width="14%"><xsl:text>&#160;</xsl:text></td>
                        <td align="right"
width="7%"><xsl:text>&#160;</xsl:text></td>
                        <td align="right" width="14%"><b><u><xsl:value-of
select="format-number(sum(
$currencies[@CURRENCY=current()/@CURRENCY]/FUND_ROW/OPENING_VALUE ),
'#,###,###,##0.00')"/></u></b></td>
                        <td align="right"
width="14%"><xsl:text>&#160;</xsl:text></td>
                        <td align="right" width="14%"><b><u><xsl:value-of
select="format-number(sum(
$currencies[@CURRENCY=current()/@CURRENCY]/FUND_ROW/CURRENT_VALUE),
'#,###,###,##0.00')"/></u></b></td>
                        <td align="right" width="14%"><b><u><xsl:value-of
select="format-number(sum(
$currencies[@CURRENCY=current()/@CURRENCY]/FUND_ROW/MTD_DIVIDEND_NUMBER),
'#,###,###,##0.00')"/></u></b></td>
                    </tr>
                            </xsl:if>
                        </xsl:for-each>



 except once we go over 4500 records or so, we get stackOverflowError....
what to do?? help!! it generates the report without grand total.. or
sometimes, it crashes tomcat as well...


        at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:530)
        at java.lang.Thread.run(Thread.java:479)
----- Root Cause -----
java.lang.StackOverflowError
        at
org.apache.xalan.xsltc.util.IntegerArray.quicksort(IntegerArray.java:198)
        at
org.apache.xalan.xsltc.util.IntegerArray.quicksort(IntegerArray.java:198)
        at
org.apache.xalan.xsltc.util.IntegerArray.quicksort(IntegerArray.java:198)
        at
org.apache.xalan.xsltc.util.IntegerArray.quicksort(IntegerArray.java:198)




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


Current Thread