ID:               44529
 User updated by:  zoran dot bodiroga at gmail dot com
 Reported By:      zoran dot bodiroga at gmail dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         XSLT related
 Operating System: Windows Server 2003
 PHP Version:      5.2.5
 New Comment:

Hi,

here is example script:

<?php
     $doc = new DOMDocument();
     $xsl = new XSLTProcessor();
     
     $doc->load('transformation.xsl',LIBXML_NOCDATA);
     $xsl->importStyleSheet($doc);
     
     $doc->load('test.xml');
     $doc = $xsl->transformToXML($doc);
     
     if(file_exists('export.xls')) unlink('export.xls');
     
     $fp = fopen('export.xls','w');
     fwrite($fp,$doc);
     fclose($fp);

?>
Here is test.xml:

<document>
<row>
<balance1>2000</balance1>
<balance2>3000</balance2>
<balance3>4000</balance3>
<balance4>5000</balance4>
</row>
</document>

There is only one row element but just multiply that for example 20000
times.

Here is transformation.xsl:

<?xml  version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
                <xsl:template match="/">
                <xsl:text disable-output-escaping="yes">

                             <![CDATA[
                                      <?mso-application
progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40";>
 <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
  <Author>Aleksandra Gavrilovic Bodiroga</Author>
  <LastAuthor>Aleksandra Gavrilovic Bodiroga</LastAuthor>
  <Created>2008-03-28T21:32:03Z</Created>
  <Version>11.5606</Version>
 </DocumentProperties>
 <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
  <WindowHeight>9210</WindowHeight>
  <WindowWidth>15195</WindowWidth>
  <WindowTopX>480</WindowTopX>
  <WindowTopY>105</WindowTopY>
  <ProtectStructure>False</ProtectStructure>
  <ProtectWindows>False</ProtectWindows>
 </ExcelWorkbook>
 <Styles>
  <Style ss:ID="Default" ss:Name="Normal">
   <Alignment ss:Vertical="Bottom"/>
   <Borders/>
   <Font/>
   <Interior/>
   <NumberFormat/>
   <Protection/>
  </Style>
  <Style ss:ID="s22">
   <Font x:Family="Swiss" ss:Bold="1"/>
   <Interior ss:Color="#C0C0C0" ss:Pattern="Solid"/>
  </Style>
 </Styles>
 <Worksheet ss:Name="Sheet1">
  <Table ss:ExpandedColumnCount="4" ss:ExpandedRowCount="30000"
x:FullColumns="1"
   x:FullRows="1">
   <Column ss:AutoFitWidth="0" ss:Width="73.5" ss:Span="3"/>
   <Row>
    <Cell ss:StyleID="s22"><Data ss:Type="String">Balance
1</Data></Cell>
    <Cell ss:StyleID="s22"><Data ss:Type="String">Balance
2</Data></Cell>
    <Cell ss:StyleID="s22"><Data ss:Type="String">Balance
3</Data></Cell>
    <Cell ss:StyleID="s22"><Data ss:Type="String">Balance
4</Data></Cell>
   </Row> ]]> </xsl:text>
   
   <xsl:for-each select="document/row">
   <xsl:text disable-output-escaping="yes">
   <![CDATA[ <Row>
    <Cell><Data ss:Type="Number">]]></xsl:text>
    <xsl:value-of select="balance1"/>
    <xsl:text disable-output-escaping="yes"><![CDATA[</Data></Cell>
    <Cell><Data ss:Type="Number">]]></xsl:text>
    <xsl:value-of select="balance2"/>
    <xsl:text disable-output-escaping="yes"><![CDATA[</Data></Cell>
    <Cell><Data ss:Type="Number">]]></xsl:text>
    <xsl:value-of select="balance3"/>
    <xsl:text disable-output-escaping="yes"><![CDATA[</Data></Cell>
    <Cell><Data ss:Type="Number">]]></xsl:text>
    <xsl:value-of select="balance4"/>
    <xsl:text disable-output-escaping="yes"><![CDATA[</Data></Cell>
   </Row>
   ]]>
   </xsl:text>
   
   </xsl:for-each>
   <xsl:text disable-output-escaping="yes">
   <![CDATA[
  </Table>
  <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   <Print>
    <ValidPrinterInfo/>
    <HorizontalResolution>300</HorizontalResolution>
    <VerticalResolution>300</VerticalResolution>
   </Print>
   <Selected/>
   <Panes>
    <Pane>
     <Number>3</Number>
     <ActiveRow>2</ActiveRow>
     <ActiveCol>3</ActiveCol>
    </Pane>
   </Panes>
   <ProtectObjects>False</ProtectObjects>
   <ProtectScenarios>False</ProtectScenarios>
  </WorksheetOptions>
 </Worksheet>
 <Worksheet ss:Name="Sheet2">
  <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   <ProtectObjects>False</ProtectObjects>
   <ProtectScenarios>False</ProtectScenarios>
  </WorksheetOptions>
 </Worksheet>
 <Worksheet ss:Name="Sheet3">
  <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   <ProtectObjects>False</ProtectObjects>
   <ProtectScenarios>False</ProtectScenarios>
  </WorksheetOptions>
 </Worksheet>
</Workbook>
                             ]]>
                             </xsl:text>
                </xsl:template>
</xsl:stylesheet> 

So, when we try this with, for example, 100 row elements everything is
ok, but then with 1000 row elements is much slower and with 20000 never
finish (maybe it finish but we stop it after 30 minutes).
Old version finish 20000 row elements within 5 seconds.

Sorry for length og message, I don't know how to post you shorter
example.

Regards,
Zoran


Previous Comments:
------------------------------------------------------------------------

[2008-03-26 19:51:12] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

Does the problem also occur when using xsltproc for the
transformations?

------------------------------------------------------------------------

[2008-03-25 12:36:44] zoran dot bodiroga at gmail dot com

Description:
------------
We develop application that use xslt to produce on screen output, pdf
and Excel files. 
Problem is that when we produce small excel files or pdf files
everything is ok but when we have, for example excel sheet with 20000
lines php block. We saw that he work something but transformation never
finish. 
We test with PHP version 5.0.3, and everything works fine.
This is information for libxslt for this version:
XSL     enabled
libxslt Version         1.1.7
libxslt compiled against libxml Version         2.6.11
EXSLT   enabled
libexslt Version        0.8.5

and for version 5.2.5:

XSL     enabled
libxslt Version         1.1.17
libxslt compiled against libxml Version         2.6.26
EXSLT   enabled
libexslt Version        0.8.13.

With old version, php takes about 120MB of memory and finish within 1
second, and with new version it block on 60 - 70MB and works
infinitely.

Also I tried with snapshot php5.2-win32-200803250030 which have latest
libxslt (ver.1.1.22) and we have the same problem.

Just to mention that in both cases we use same XSL and XML files.

Regards,
Zoran Bodiroga





------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44529&edit=1

Reply via email to