note 39701 added to function.xslt-process

From: Date: Sun, 08 Feb 2004 03:00:15 +0000
Subject: note 39701 added to function.xslt-process
Groups: php.notes 
Request: Send a blank email to php-notes+get-64802@lists.php.net to get a copy of this message
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); ?> ---- Manual Page -- http://www.php.net/manual/en/function.xslt-process.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39701 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39701&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39701&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64802) next »