XSLTProcessor::transformToXML
(No version information available, might be only in CVS)
XSLTProcessor::transformToXML — Transforma para XML
Descrição
XSLTProcessor
string
transformToXML
( DOMDocument $doc
)
Transforma o node para uma string aplicando o stylesheet dado pelo método XSLTProcessor::importStylesheet.
Parâmetros
- doc
-
O documento transformado.
Valor Retornado
O resultado da transformação como uma string ou FALSE em caso de erro.
Exemplos
Example#1 Transformando para uma string
<?php
// Load the XML source
$xml = new DOMDocument;
$xml->load('collection.xml');
$xsl = new DOMDocument;
$xsl->load('collection.xsl');
// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules
echo $proc->transformToXML($xml);
?>
O exemplo acima irá imprimir:
Hey! Welcome to Nicolas Eliaszewicz's sweet CD collection! <h1>Fight for your mind</h1><h2>by Ben Harper - 1995</h2><hr> <h1>Electric Ladyland</h1><h2>by Jimi Hendrix - 1997</h2><hr>