update page now
Laravel Live Japan

Voting

: five plus zero?
(Example: nine)

The Note You're Voting On

jw at jwscripts dot com
21 years ago
The following code is a wrapper to support calls to some of the old xslt_* functions:
<?
if (PHP_VERSION >= 5) {
 // Emulate the old xslt library functions
 function xslt_create() {
 return new XsltProcessor();
 }
 function xslt_process($xsltproc, 
 $xml_arg, 
 $xsl_arg, 
 $xslcontainer = null, 
 $args = null, 
 $params = null) {
 // Start with preparing the arguments
 $xml_arg = str_replace('arg:', '', $xml_arg);
 $xsl_arg = str_replace('arg:', '', $xsl_arg);
 // Create instances of the DomDocument class
 $xml = new DomDocument;
 $xsl = new DomDocument;
 // Load the xml document and the xsl template
 $xml->loadXML($args[$xml_arg]);
 $xsl->loadXML($args[$xsl_arg]);
 // Load the xsl template
 $xsltproc->importStyleSheet($xsl);
 // Set parameters when defined
 if ($params) {
 foreach ($params as $param => $value) {
 $xsltproc->setParameter("", $param, $value);
 }
 }
 // Start the transformation
 $processed = $xsltproc->transformToXML($xml);
 // Put the result in a file when specified
 if ($xslcontainer) {
 return @file_put_contents($xslcontainer, $processed);
 } else {
 return $processed;
 }
 }
 function xslt_free($xsltproc) {
 unset($xsltproc);
 }
}
$arguments = array(
 '/_xml' => file_get_contents("newxslt.xml"),
 '/_xsl' => file_get_contents("newxslt.xslt")
);
$xsltproc = xslt_create();
$html = xslt_process(
 $xsltproc, 
 'arg:/_xml', 
 'arg:/_xsl', 
 null, 
 $arguments
);
xslt_free($xsltproc);
print $html;
?>

<< Back to user notes page

AltStyle によって変換されたページ (->オリジナル) /