note 44580 deleted from function.xsl-xsltprocessor-set-parameter by didou
| From: | didou@php.net | Date: | Mon, 27 Dec 2004 22:29:18 +0000 |
| Subject: | note 44580 deleted from function.xsl-xsltprocessor-set-parameter by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82374@lists.php.net to get a copy of this message | ||
Note Submitter: hidde at driebit dot nl
----
You can use the setParameter function to add an external value to your xslt transformation:
Example:
$xml_file = "book.xml";
$xsl_file = "shortview.xsl";
/* Configure the transformer */
$proc = new xsltprocessor;
$proc->setParameter("","date_changed",Date("Ymd"));
$xmlDoc = new DomDocument; // from /ext/dom
$xmlDoc->load($xml_file);
$xslDoc= new DomDocument;
$xslDoc->load($xsl_file);
$proc->importStyleSheet($xslDoc); // attach the xsl rules
echo $proc->transformToXML($xmlDoc);
In your XSL stylesheet you can then use this value wherever you need it liek this:
<xsl:value-of select="$date_changed"/>