note 28444 added to function.xslt-process

From: Date: Mon, 13 Jan 2003 19:13:57 +0000
Subject: note 28444 added to function.xslt-process
Groups: php.notes 
Request: Send a blank email to php-notes+get-42066@lists.php.net to get a copy of this message
It seems to be undocumented how to get the XSL parser to use two XML files at the same time to produce the output. It is possible though. Here is how it's done with the XML data in a variable: First you need to change the 5th argument. $xh = xslt_create(); $args = array('/_xml'=>$xml1, '/_xsl'=>$xsl, 'xml2'=>$xml2); $result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $args); Inside the XSLT document you then need to do this: <xsl:template match="/"> <root> <foo> <xsl:value-of select="/foo" /> </foo> <bar> <xsl:value-of select="document('xml2')/bar" /> </bar> </root> </xsl:template> This creates a XML result containing a root node called "root" containing two nodes. One called "foo" with the content of the root node in $xml1 and one called "bar" with the content of the root node in $xml2. In the $args array I don't know if it is best to write "'xml2'=>$xml2" or "'/xml2'=>$xml2". Both work. I think it has something to do with the level of the argument (/level1/level2/level3). Maybe this site reveals the true syntax: http://www.gingerall.com/charlie/ga/act/gadoc.act?pg=sablot#i__1029 I don't know if there is another - more elegant way - to do this. But I can't find any documentation on it. For the moment I can't get this to work in PHP 4.3.0/Windows because there seems to be a problem with the Sablotron that is shipped with this version (I have not tried the UNIX version though). I think a new version of the sablot.dll will fix this problem. But for the moment I can't seem to get PHP to work with this new version. If anyone knows how to do this then please send me a mail. I'll post anything that I find out. /watson -- http://www.php.net/manual/en/function.xslt-process.php http://master.php.net/manage/user-notes.php?action=edit+28444 http://master.php.net/manage/user-notes.php?action=delete+28444 http://master.php.net/manage/user-notes.php?action=reject+28444

« previous php.notes (#42066) next »