PHP Velho Oeste 2024

XSLTProcessor::__construct

(PHP 5, PHP 7, PHP 8)

XSLTProcessor::__constructErzeugt ein neues XSLTProcessor-Objekt

Beschreibung

XSLTProcessor::__construct()

Erzeugt ein neues XSLTProcessor-Objekt.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Beispiele

Beispiel #1 Verwendung von XSLTProcessor

<?php

$xsldoc
= new DOMDocument();
$xsldoc->load($xsl_filename);

$xmldoc = new DOMDocument();
$xmldoc->load($xml_filename);

$xsl = new XSLTProcessor();
$xsl->importStyleSheet($xsldoc);
echo
$xsl->transformToXML($xmldoc);

?>

add a note add a note

User Contributed Notes 1 note

up
1
Martin
14 years ago
The example above is a bit confusing because it uses the same variable ($doc) for two different things. I would rather write

<?php

$xsl
= new XSLTProcessor();
$xsldoc = new DOMDocument();
$xsldoc->load($xsl_filename);
$xsl->importStyleSheet($xsldoc);

$xmldoc = new DOMDocument();
$xmldoc->load($xml_filename);
echo
$xsl->transformToXML($xmldoc);

?>

[ Editor's note - thiago AT php DOT net: This note has improvements from Matthieu ]
To Top