Re: PHP newbie question on xslt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Miguel J. Jiménez" wrote:

>> // Example 2520. Creating an XSLTProcessor
>>
>> <?php
>>
>> $xml_filename = "collection.xml";
>> $xsl_filename= "collection.xsl";
>>
>> $doc = new DOMDocument();
>> $xsl = new XSLTProcessor();
>>
>> $doc->load($xsl_filename);
>> $xsl->importStyleSheet($doc);
>>
>> $doc->load($xml_filename);
>> echo $xsl->transformToXML($doc);
>>
>> ?>
>> ----------------------------
>> (where I have added the two filenames,
>> and copied the files collection.x?l from the manual).
>>
>> When I run PHP I get:
>> ----------------------------
>> [root@alfred Test]# php ex2520.php
>> // Example 2520. Creating an XSLTProcessor
>>
>> Segmentation fault
>> ----------------------------
>>
>> I'm running the program under Fedora-6 Linux
>> with the latest versions of all programs.
>>
>> Is there something I should have included,
>> to get the program to run?
>>
>> Any advice or suggestions gratefully received.
> 
> Try not to load both xml and xsl in the same $doc variable... use one
> for the xsl and another for the xml. I think you are destroying the dom
> for the xsl before the transform...

Thanks for the response.
I'm sure you are right.
However, I wasn't "trying" anything really -
I just copied (electronically) Example 2520 from
http://www.php.net/manual/en/function.xsl-xsltprocessor-construct.php
and ran it.

Is there in fact some confusion in this manual
between different versions of PHP,
or at least of PHP/XSLT?

I notice that I get the same (bad) result if I run
---------------------------------
// Example 2526. Transforming to a string

<?php

// Load the XML source
$xml = new DOMDocument;
$xml->load('collection.xml');

$xsl = new DOMDocument;
$xsl->load('collection.xsl');

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

echo $proc->transformToXML($xml);

?>
---------------------------------
from
http://www.php.net/manual/en/function.xsl-xsltprocessor-transform-to-xml.php
---------------------------------
[root@alfred Test]# php ex2526.php
// Example 2526. Transforming to a string

Segmentation fault
---------------------------------

Is there any way of debugging a PHP program like this?
(I tried running "strace php ex2526.php"
but this didn't enlighten me.)




-- 
Timothy Murphy  
e-mail (<80k only): tim /at/ birdsnest.maths.tcd.ie
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux