View Full Version : php trasformazione xml + xsl
texerasmo
17-04-2007, 10:18
Nel mi php. ini ho abilitato questa tre dll
extension=php_xmlrpc.dll
extension=php_xsl.dll
extension=php_domxml.dll
Come posso fare un semplice trasformazioni tra xml xsl:
vorei fare un cosa del genere
$xslt = new xsltProcessor;
$xslt->importStyleSheet(DomDocument::load('c:\test.xsl'));
print $xslt->transformToXML(DomDocument::loadXML('c:\test.xml'));
Quindi vorrei pasargli un file xml e un file xsl e vedere pou output
mi potete aiutare
texerasmo
17-04-2007, 10:43
ho trovato questo esempio ma no mi funziona
$dom=new domDocument();
$dom->load('C:\Programmi\EasyPHP 2.0b1\www\cell\test.xsl');
$proc=new xsltprocessor;
$xsl=$proc->importStylesheet($dom);
$xml=new domDocument();
$xml->load('C:\Programmi\EasyPHP 2.0b1\www\cell\test.xml');
$string=$proc->transformToXml($xml);
echo $string;
mi da questo errore
Warning: domdocument::domdocument() expects at least 1 parameter, 0 given in C:\Programmi\EasyPHP 2.0b1\www\cell\xmlxsl.php on line 69
Fatal error: Call to undefined method domdocument::load() in C:\Programmi\EasyPHP 2.0b1\www\cell\xmlxsl.php on line 70
$dom=new domDocument();
$dom->load('C:\Programmi\EasyPHP 2.0b1\www\cell\test.xsl');
$proc=new xsltprocessor;
$xsl=$proc->importStylesheet($dom);
$xml=new domDocument();
$xml->load('C:\Programmi\EasyPHP 2.0b1\www\cell\test.xml');
$string=$proc->transformToXml($xml);
echo $string;
mi da questo errore
Warning: domdocument::domdocument() expects at least 1 parameter, 0 given in C:\Programmi\EasyPHP 2.0b1\www\cell\xmlxsl.php on line 69
Fatal error: Call to undefined method domdocument::load() in C:\Programmi\EasyPHP 2.0b1\www\cell\xmlxsl.php on line 70Quel codice va bene per PHP 5, non per PHP 4 (č quello che ho dedotto andando a leggere la documentazione).
texerasmo
17-04-2007, 12:29
PHP Version 5.2.0
io sto usando questa versione
PHP Version 5.2.0
io sto usando questa versioneIl tuo codice l'ho provato da me che ho PHP 5.1.6 e funziona.
Strano ... ci deve essere qualcos'altro!
Il costruttore di DOMDocument si aspetta 2 parametri, che perņ mi risulta siano opzionali. Visto che nell'errore dice che si aspetta almeno 1 parametro, prova a passagli '1.0'.
Per il problema del load, mi sembra strano che non trovi il metodo.
texerasmo
17-04-2007, 12:45
ho trovato
sono le dll
per caso mi protresti passare
php_xsl.dll
ho trovato
sono le dll
per caso mi protresti passare
php_xsl.dllTrovi le DLL delle altre release <qui> (http://it.php.net/releases/index.php)
texerasmo
17-04-2007, 13:51
grazie
texerasmo
15-05-2007, 11:25
riprendendo questa discussione,
mi č sorti un pb.
Come posso passare all'xsl un parametro?
The Incredible
25-07-2007, 19:07
riprendendo questa discussione..
sto usando:
xml e wamp devo impostare qlc di particolare? siccome mi ritorna:
Fatal error: Call to undefined function xslt_create() in /opt/lampp/htdocs/arbay/genera.php on line 18
texerasmo
27-07-2007, 10:19
<?php
class Utilityxml {
function Trasformazionexml($filexml,$filexsl,$arrpar){
$dom=new domDocument();
$dom->load($filexsl);
$proc=new xsltprocessor;
$xsl=$proc->importStylesheet($dom);
$proc->setParameter( "",$arrpar);
$xml=new domDocument();
$xml->load($filexml);
$string=$proc->transformToXml($xml);
return $string;
}//chiudo Trasformazionexml
}//chiudo Utilityxml
spero che ti posssa aiutare
vBulletin® v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.