473,785 Members | 2,553 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP 5, XSL transformations of big files

Hi.

I'm going to make in auto some tasks that I'm doing manually every
day. I'm uploading big XML file (~20mb) and then I'm using XSLT schema
to transform it to MySQL queries file.

I have used 3rd tools to process XSLT and it takes few seconds to
process my big XML file.

But now I'm moving to PHP so I'm trying to use XSL PHP extension to
apply my XSL file. But... it takes minutes... I allowed 10 minutes
( set_time_limit( 600) ) and it still crashes and says that time
excited.

So please somebody help me to find a way out of the impasse. I can't
move forward now because of slow XSL processing.

The code I'm using is:

*******
// Load the XML source
$xml = new DOMDocument;
$xml->load('extracte d/marketplace_fee d_v1.xml');

$xsl = new DOMDocument;
$xsl->load('cb_marke tplace_feed_com pact.xsl');

// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleShe et($xsl); // attach the xsl rules

$sqlCommands = $proc->transformToXML ($xml);
if ($sqlCommands == FALSE)
{
echo "XSLT transformation failed";
exit;
}

if (file_put_conte nts('cbfeed.sql ', $sqlCommands) == FALSE);
{
echo 'Failed to save XSLT transformation result to the file
"cbfeed.sql "';
exit;
}
*******

You can upload files used in my script here:

http://megliosoft.org/meglio/cbfeed/...ce_feed_v1.xml
http://megliosoft.org/meglio/cbfeed/...ed_compact.xsl
Any information may help.

Thanks,
Anton
Jun 2 '08 #1
12 3356
try to use javascript xslt transformation:
http://www.w3schools.com/xsl/xsl_client.asp

probaly faster

Meglio wrote:
Hi.

I'm going to make in auto some tasks that I'm doing manually every
day. I'm uploading big XML file (~20mb) and then I'm using XSLT schema
to transform it to MySQL queries file.

I have used 3rd tools to process XSLT and it takes few seconds to
process my big XML file.

But now I'm moving to PHP so I'm trying to use XSL PHP extension to
apply my XSL file. But... it takes minutes... I allowed 10 minutes
( set_time_limit( 600) ) and it still crashes and says that time
excited.

So please somebody help me to find a way out of the impasse. I can't
move forward now because of slow XSL processing.

The code I'm using is:

*******
// Load the XML source
$xml = new DOMDocument;
$xml->load('extracte d/marketplace_fee d_v1.xml');

$xsl = new DOMDocument;
$xsl->load('cb_marke tplace_feed_com pact.xsl');

// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleShe et($xsl); // attach the xsl rules

$sqlCommands = $proc->transformToXML ($xml);
if ($sqlCommands == FALSE)
{
echo "XSLT transformation failed";
exit;
}

if (file_put_conte nts('cbfeed.sql ', $sqlCommands) == FALSE);
{
echo 'Failed to save XSLT transformation result to the file
"cbfeed.sql "';
exit;
}
*******

You can upload files used in my script here:

http://megliosoft.org/meglio/cbfeed/...ce_feed_v1.xml
http://megliosoft.org/meglio/cbfeed/...ed_compact.xsl
Any information may help.

Thanks,
Anton
Jun 2 '08 #2
Thiago Macedo wrote:
try to use javascript xslt transformation:
http://www.w3schools.com/xsl/xsl_client.asp

probaly faster

Meglio wrote:
>Hi.

I'm going to make in auto some tasks that I'm doing manually every
day. I'm uploading big XML file (~20mb) and then I'm using XSLT schema
to transform it to MySQL queries file.

I have used 3rd tools to process XSLT and it takes few seconds to
process my big XML file.

But now I'm moving to PHP so I'm trying to use XSL PHP extension to
apply my XSL file. But... it takes minutes... I allowed 10 minutes
( set_time_limit( 600) ) and it still crashes and says that time
excited.

So please somebody help me to find a way out of the impasse. I can't
move forward now because of slow XSL processing.

The code I'm using is:

*******
// Load the XML source
$xml = new DOMDocument;
$xml->load('extracte d/marketplace_fee d_v1.xml');

$xsl = new DOMDocument;
$xsl->load('cb_marke tplace_feed_com pact.xsl');

// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleShe et($xsl); // attach the xsl rules

$sqlCommands = $proc->transformToXML ($xml);
if ($sqlCommands == FALSE)
{
echo "XSLT transformation failed";
exit;
}

if (file_put_conte nts('cbfeed.sql ', $sqlCommands) == FALSE);
{
echo 'Failed to save XSLT transformation result to the file
"cbfeed.sql" ';
exit;
}
*******

You can upload files used in my script here:

http://megliosoft.org/meglio/cbfeed/...ce_feed_v1.xml
http://megliosoft.org/meglio/cbfeed/...ed_compact.xsl
Any information may help.

Thanks,
Anton
How is that going to help? Javascript is client side - he'd have to
download those large files, then do it on the client and finally upload
the results. And clients machines are typically less powerful than servers.

A very bad suggestion, IMHO.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Jun 2 '08 #3
On May 3, 1:05 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
Thiago Macedo wrote:
try to use javascript xslt transformation:
http://www.w3schools.com/xsl/xsl_client.asp
probaly faster
Meglio wrote:
Hi.
I'm going to make in auto some tasks that I'm doing manually every
day. I'm uploading big XML file (~20mb) and then I'm using XSLT schema
to transform it to MySQL queries file.
I have used 3rd tools to process XSLT and it takes few seconds to
process my big XML file.
But now I'm moving to PHP so I'm trying to use XSL PHP extension to
apply my XSL file. But... it takes minutes... I allowed 10 minutes
( set_time_limit( 600) ) and it still crashes and says that time
excited.
So please somebody help me to find a way out of the impasse. I can't
move forward now because of slow XSL processing.
The code I'm using is:
*******
// Load the XML source
$xml = new DOMDocument;
$xml->load('extracte d/marketplace_fee d_v1.xml');
$xsl = new DOMDocument;
$xsl->load('cb_marke tplace_feed_com pact.xsl');
// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleShe et($xsl); // attach the xsl rules
$sqlCommands = $proc->transformToXML ($xml);
if ($sqlCommands == FALSE)
{
echo "XSLT transformation failed";
exit;
}
if (file_put_conte nts('cbfeed.sql ', $sqlCommands) == FALSE);
{
echo 'Failed to save XSLT transformation result to the file
"cbfeed.sql "';
exit;
}
*******
You can upload files used in my script here:
>http://megliosoft.org/meglio/cbfeed/...ce_feed_v1.xml
http://megliosoft.org/meglio/cbfeed/...ed_compact.xsl
Any information may help.
Thanks,
Anton

How is that going to help? Javascript is client side - he'd have to
download those large files, then do it on the client and finally upload
the results. And clients machines are typically less powerful than servers.

A very bad suggestion, IMHO.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===
sorry for not acquiring your "requisites ".. but, if it will run on a
server, instead of download this large file, he'll upload it.. and
this is usually worst.
by the way, probaly the timeout is occurring in the file upload, not
in the transformation. already examined where it stops the execution?

regards,

Thiago
Jun 2 '08 #4
Jerry Stuckle wrote:
Thiago Macedo wrote:
>try to use javascript xslt transformation:
[...]
How is that going to help?
By not crashing. This one's a quick & dirty automation task, so it ain't to
be pretty.
Javascript is client side - he'd have to download those large files, then
do it on the client and finally upload the results. And clients machines
are typically less powerful than servers.
We can suppose the O.P. is inside a LAN and that semi-large files are not a
problem.


Meglio wrote:
I have used 3rd tools to process XSLT and it takes few seconds to
process my big XML file.

But now I'm moving to PHP so I'm trying to use XSL PHP extension to
apply my XSL file. But... it takes minutes...
I might get kicked out of here for saying here, but maybe PHP isn't the
right tool for this particular job.

You can consider using PHP as a web frontend, and use exec() to call a
command-line xsltproc, or any other 3rd-party tool. You can also do
client-side processing, given you have set the size limits for uploads
right.

I allowed 10 minutes ( set_time_limit( 600) ) and it still crashes and says
that time excited.
Can we have a look at the *exact* error message?
--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Y dijo el capitán Bloub: "Abordar el barco"... y les quedó precioso.
Jun 2 '08 #5
On May 3, 7:15 am, Thiago Macedo <thiago.ch...@g mail.comwrote:
On May 3, 1:05 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
Thiago Macedo wrote:
try to use javascript xslt transformation:
>http://www.w3schools.com/xsl/xsl_client.asp
probaly faster
Meglio wrote:
>Hi.
>I'm going to make in auto some tasks that I'm doing manually every
>day. I'm uploading big XML file (~20mb) and then I'm using XSLT schema
>to transform it to MySQL queries file.
>I have used 3rd tools to process XSLT and it takes few seconds to
>process my big XML file.
>But now I'm moving to PHP so I'm trying to use XSL PHP extension to
>apply my XSL file. But... it takes minutes... I allowed 10 minutes
>( set_time_limit( 600) ) and it still crashes and says that time
>excited.
>So please somebody help me to find a way out of the impasse. I can't
>move forward now because of slow XSL processing.
>The code I'm using is:
>*******
>// Load the XML source
>$xml = new DOMDocument;
>$xml->load('extracte d/marketplace_fee d_v1.xml');
>$xsl = new DOMDocument;
>$xsl->load('cb_marke tplace_feed_com pact.xsl');
>// Configure the transformer
>$proc = new XSLTProcessor;
>$proc->importStyleShe et($xsl); // attach the xsl rules
>$sqlCommands = $proc->transformToXML ($xml);
>if ($sqlCommands == FALSE)
>{
> echo "XSLT transformation failed";
> exit;
>}
>if (file_put_conte nts('cbfeed.sql ', $sqlCommands) == FALSE);
>{
> echo 'Failed to save XSLT transformation result to the file
>"cbfeed.sql" ';
> exit;
>}
>*******
>You can upload files used in my script here:
>>http://megliosoft.org/meglio/cbfeed/...ce_feed_v1.xml
>>http://megliosoft.org/meglio/cbfeed/...ed_compact.xsl
>Any information may help.
>Thanks,
>Anton
How is that going to help? Javascript is client side - he'd have to
download those large files, then do it on the client and finally upload
the results. And clients machines are typically less powerful than servers.
A very bad suggestion, IMHO.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===

sorry for not acquiring your "requisites ".. but, if it will run on a
server, instead of download this large file, he'll upload it.. and
this is usually worst.
by the way, probaly the timeout is occurring in the file upload, not
in the transformation. already examined where it stops the execution?

regards,

Thiago
>if it will run on a server, instead of download this large file, he'll upload it.. and
this is usually worst.

THIS is not worst because when I do it manually I still transform XML
to SQL (which is big file too) and upload it to the server. So I have
to upload SQL to the server in any case. The goal is to upload XML
directly to the server on auto and to transform it to SQL file using
PHP script.
>by the way, probably the timeout is occurring in the file upload, not
in the transformation. already examined where it stops the execution?

I'm not so stupid to ask question before to examine where it stops. It
freezes on XSL transformation.
Jun 2 '08 #6
Fatal error: Maximum execution time of ... seconds exceeded in ... on
line ...
Jun 2 '08 #7
Meglio wrote:
Hi.

I'm going to make in auto some tasks that I'm doing manually every
day. I'm uploading big XML file (~20mb) and then I'm using XSLT schema
to transform it to MySQL queries file.

I have used 3rd tools to process XSLT and it takes few seconds to
process my big XML file.

But now I'm moving to PHP so I'm trying to use XSL PHP extension to
apply my XSL file. But... it takes minutes... I allowed 10 minutes
( set_time_limit( 600) ) and it still crashes and says that time
excited.

So please somebody help me to find a way out of the impasse. I can't
move forward now because of slow XSL processing.
Maybe there is some issue that causes PHP xslt processor to fail or go
into infinite loop. Try cutting the xsl template to few smaller parts
(just for test) and see if the error occurs in any specyfic part. Maybe
there is some syntax used that PHP doesn't really like..

Not an xsl expert, so if this is way off, just ignore..

best regards
Piotr N
Jun 2 '08 #8
On May 3, 11:29 am, Piotr <s...@poczta.on et.plwrote:
Meglio wrote:
Hi.
I'm going to make in auto some tasks that I'm doing manually every
day. I'm uploading big XML file (~20mb) and then I'm using XSLT schema
to transform it to MySQL queries file.
I have used 3rd tools to process XSLT and it takes few seconds to
process my big XML file.
But now I'm moving to PHP so I'm trying to use XSL PHP extension to
apply my XSL file. But... it takes minutes... I allowed 10 minutes
( set_time_limit( 600) ) and it still crashes and says that time
excited.
So please somebody help me to find a way out of the impasse. I can't
move forward now because of slow XSL processing.

Maybe there is some issue that causes PHP xslt processor to fail or go
into infinite loop. Try cutting the xsl template to few smaller parts
(just for test) and see if the error occurs in any specyfic part. Maybe
there is some syntax used that PHP doesn't really like..

Not an xsl expert, so if this is way off, just ignore..

best regards
Piotr N
Hi. Thanks for you advice. But i'm not XSLT expert too so it is not
simple way for me to find such bug. So I'm still looking for an expert
who can help me to understand where the problems is.

Thanks,
Anton
Jun 2 '08 #9
Meglio wrote:
>Maybe there is some issue that causes PHP xslt processor to fail or go
into infinite loop. Try cutting the xsl template to few smaller parts
(just for test) and see if the error occurs in any specyfic part. Maybe
there is some syntax used that PHP doesn't really like..

Not an xsl expert, so if this is way off, just ignore..

best regards
Piotr N

Hi. Thanks for you advice. But i'm not XSLT expert too so it is not
simple way for me to find such bug. So I'm still looking for an expert
who can help me to understand where the problems is.

Thanks,
Anton
Afaik, you should find tags like his:

<xsl:template match="some_tag ">
[..]
</xsl:template>

if you have more then one, simply comment all but one, see if this times
out, if it doesn't, comment this template out and uncomment next one. Do
so as long as you find the one that times out.

When you find that one, comment out some functions, like xsl:for-each.
To comment, use <!-- --syntax.

I suppose there is also xsl group for xslt specific problems.

best regards
Piotr N
Jun 2 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1528
by: Mike | last post by:
I am trying to code vb.net to perform XML transformations by applying a style sheet to a XML doc. All of my XML and XSLT documents will be in either XML DOM Objects or string variables. I am not reading anything from Disk. Prior to .NET, I would this with the following code: ------ ******************* -------- 'Load Source cXML into DOM object Set objSource = server.CreateObject("microsoft.xmldom") objSource.loadXML(SourceXML)
0
1765
by: Franck Perrin | last post by:
I'd like to know if there is a way to apply to successive XSL transformations on one XML file. I got this XML file : <page Action="N047"> <data defaultName="c0dos010" Type="String" CustomName=""/> <data defaultName="clxc0233" Type="String" CustomName="EndDate"/> </page> I want to generate java code like this :
5
2563
by: Keith Chadwick | last post by:
I am migrating an existing ASP app that uses XSLT transformations to render against a language XML doc for localization and other items. When I moved this logic into .NET and the native xml and xsl objects I noticed a significant processor hit on the web machine. The xml file is roughly 110KB and the XSLT files, the called transformation has several includes, is in total about 20KB. I have run the application test center on the page which...
1
1121
by: Chris | last post by:
I am doing a little research into the xml web server control and in particular the ability to do transformations with it. However all's I can see is the ability to feed in from an actual xml file. This doesn't seem very scalable if you want have a high volume dynamic web page like a product catalogue. Is there any way to bind the xml control to a dataset, or something a little more like that.
6
3237
by: Christopher | last post by:
I am currently in the process of evaluating the performance hits of moving to the .NET platform for our application. I created a sample project that loads the transforms the same XML and XSLT in COM, COM using interop and in C# and then transforms it to HTML. I also tried concatenating the XML and XSL as a string and then loading it to the DOM once as opposed to loading the DOM with the appendChild() method. I see that the C# version is...
1
1930
by: George Durzi | last post by:
Folks, I'm running into some performance issues with my Xsl transformations. I've done a ton of debugging and digging around, and have come to the conclusion that the performance issues are NOT caused by slow stored procedures, or bad XSL/Ts. I came to this conclusion by doing a test transformation in client-side code instead of server side aspx, as shown at the bottom of this post. The transformations were super-fast. However, the...
0
1320
by: Alain Frisch | last post by:
Hello, I'd like to announce a new small language for XML transformation, called XStream. Transformations written in XStream are compiled into efficient XML stream processors: the output is computed and produced while the input is being parsed, which makes it possible to run some transformations on very big XML documents which could not even fit in memory. The programmer does not have to worry about streaming or buffering, this is all...
0
968
by: Hoax | last post by:
I didn't see a forum for OpenGL so i assume it would go here. I've having an issues with my camera interfering with the transformations of my geometry. Here is my Display() code, I think it's pretty straight forward. void Display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); eyePos.Set(0,0,10); //this is my wrist position
0
1775
by: Geico Caveman | last post by:
Hello, I am trying to generate a doc file from latex source for a colleague (simple article class, using authblk package) through one of the two following ways : 1. Create an odt file using : $mk4ht oolatex document.tex "xhtml,ooffice,mathml"
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10090
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.