php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44529 XSL Transformation never finishes
Submitted: 2008-03-25 12:36 UTC Modified: 2008-11-03 01:00 UTC
From: zoran dot bodiroga at gmail dot com Assigned:
Status: No Feedback Package: XSLT related
PHP Version: 5.2.5 OS: Windows Server 2003
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: zoran dot bodiroga at gmail dot com
New email:
PHP Version: OS:

 

 [2008-03-25 12:36 UTC] 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




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-28 23:00 UTC] zoran dot bodiroga at gmail dot com
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
 [2008-10-26 23:14 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2008-11-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 07:01:28 2024 UTC