note 39701 deleted from function.xslt-process by sobak

From: Date: Tue, 22 Nov 2016 03:34:17 +0000
Subject: note 39701 deleted from function.xslt-process by sobak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-207366@lists.php.net to get a copy of this message
Note Submitter: ajenks at paradise dot net dot nz ---- By combining some of the user added notes and some experimentation, here's how I finally got the query string broken down and passed in as top-level parameters: With a little more effort, this could be turned into a completely generic transform script - i.e. by adding query parms for the xml and xsl files also and excluding them from the $params array (though this lat bit may not be necessary). Thanks to all those other users whose tips make up most of this solution! <?php // Process query string to $params array $vars = explode("&", $_SERVER['QUERY_STRING']); for ($i=0;$i<=count($vars);$i++) { $var = explode("=", $vars[$i]); $params[$var[0]] = $var[1]; } // Fire up the engine $xslt = xslt_create(); $xml = 'test.xml'; $xsl = 'test.xsl'; $result = xslt_process($xslt, $xml, $xsl, NULL, array(), $params); if ($result) { echo $result; } else { print "Error:" . xslt_errno($xslt); } xslt_free($xslt); ?>

« previous php.notes (#207366) next »