note 44580 added to function.xsl-xsltprocessor-set-parameter
| From: | hidde at driebit dot nl | Date: | Tue, 10 Aug 2004 05:53:50 +0000 |
| Subject: | note 44580 added to function.xsl-xsltprocessor-set-parameter | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-74386@lists.php.net to get a copy of this message | ||
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"/>
----
Manual Page -- http://www.php.net/manual/en/function.xsl-xsltprocessor-set-parameter.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44580
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44580&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44580&report=yes
Search -- http://master.php.net/manage/user-notes.php