note 22196 deleted from function.xslt-process by sobak
| From: | sobak@php.net | Date: | Tue, 22 Nov 2016 03:32:01 +0000 |
| Subject: | note 22196 deleted from function.xslt-process by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207343@lists.php.net to get a copy of this message | ||
Note Submitter: tkearns at fastmail dot fm
----
For those of you wondering what the hell is up with the very strange format for refering to
in-memory data, see
http://www.gingerall.com/charlie/ga/act/gadoc.act?pg=sablot#i__1029
normally you pass a file name (or URI) using the 'file:' syntax. The 'arg:'
syntax introduced by sablotron does not refer to a file system path, it refers to an ARGument - and
of course, arguments are in-memory. In the case of PHP, the argument reference is an index to the
array in parameter 5 of the xslt_process() function. I think the forward slash is just to maintain
the convention of path notation.
Someone with more knowledge on the topic could probably provide a more concise definition. If so, it
would be nice to have it included as part of the standard documentation set.
Some wrapper functions would make things easier still.
Here's a wrapper I wrote.
function XtDataWithFile($xmlData, $uriXSLT) {
$args = array ( '/_xml' => $xmlData );
$xp = xslt_create();
$out = xslt_process($xp, 'arg:/_xml', $uriXSLT, NULL, $args);
xslt_free($xp);
return $out;
}
of course you could do XtFileWithData() can XtDataWithData()