Trasformazione XSLT
| From: | Agnoletto Christian | Date: | Fri, 25 Oct 2002 08:27:04 +0000 |
| Subject: | Trasformazione XSLT | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-121394@lists.php.net to get a copy of this message | ||
Ciao a tutti, ho bisogno di qualche dritta:
Voglio utilizzare la trasformazione xslt ma mi servirebbe un modello xslt di
esempio per vedere se il mio è errato
Allego il mio di test:
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<head>
<title><xsl:value-of select="catalogo/data"/></title>
</head>
<body>
<xsl:value-of select="catalogo"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Quando faccio la trasformazione il risultato è uguale al xsl e non alla
fusione col documento xml.
Allego anche la prima parte per chiarezza:
<?php
$doc = domxml_new_doc("1.0");
$catalogo = $doc->add_root('catalogo');
$data = $catalogo->new_child('data','oggi');
$xml_string=$doc->dump_mem(true);
$xsl_file='style.xsl';
$xsl_parames="";
XSLTrasform($xml_string,$xsl_file,$xsl_params);
function XSLTrasform(&$xml_string,$xsl_file,&$xsl_params){
$xsl_string=join("",file($xsl_file));
$arg_buffer=array("/xml" =>$xml_string,"/xslt"=>$xsl_string);
$xp=xslt_create() or die ("Non posso creare il processo");
$cwd='file://'.dirname($_SERVER['SCRIPT_FILENAME'])."/";
xslt_set_base($xp,$cwd);
if ($result=xslt_process($xp,"arg:/xml","arg:/xslt",null,$arg_buffer)){
echo $result;
}else{
echo ("Errore nell'elaborazione");
};
xslt_free($xp);
return;
};
?>
Distinti saluti,
P.I. Agnoletto Christian
CEDA Computers S.r.l.