note 39285 added to function.xslt-process

From: Date: Fri, 23 Jan 2004 01:45:22 +0000
Subject: note 39285 added to function.xslt-process
Groups: php.notes 
Request: Send a blank email to php-notes+get-64052@lists.php.net to get a copy of this message
Figuring out the syntax to get parameters in was difficult but this works for me: // Allows user to pass argument from URL as script.php?foo=VALUE $xml = file_get_contents ('n.xml') ; $xsl = file_get_contents ('n.xsl') ; // Perform the transformation $args = array ( '/_xml' => $xml, '/_xsl' => $xsl ); $params = array ( 'foo' => $foo ) ; $html = xslt_process($xsltproc, 'arg:/_xml', 'arg:/_xsl', NULL, $args, $params); then in the XSL FILE: -------------------------- <xsl:param name="foo"/> <xsl:template match="/"> <root> <test><xsl:value-of select="$foo"/></test> <xsl:apply-templates/></root> </xsl:template> Note: the param definition and the '$' dollar sign ---- Manual Page -- http://www.php.net/manual/en/function.xslt-process.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39285 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39285&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39285&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64052) next »