Popis
mixed
xslt_process ( resource xh, string xmlcontainer, string xslcontainer [, string resultcontainer [, array arguments [, array parameters]]] )
xslt_process() pÅ™ijÃmá jako prvnà argument Å™etÄ›zec
obsahujÃcà XSLT stylesheet, jako druhý argument Å™etÄ›zec obsahujÃcà XML data,
která chcete transformovat, a jako tÅ™età argument Å™etÄ›zec obsahujÃcÃcÃ
výsledky transformace.
xslt_process() vracà TRUE při úspěchu
a FALSE pÅ™i selhánÃ. ÄŒÃslo a text chyby pÅ™ÃpadnÄ› vzniklé
pÅ™i transformaci můžete zÃskat pomocà xslt_errno() a
xslt_error() funkcÃ.
PÅ™Ãklad 1.
Použità xslt_process() k transformaci třà řetězců
<?php
$xslData = ' <xsl:stylesheet version="1.0" xmlns:xsl="https://www.w3.org/1999/XSL/Transform">
<xsl:template match="article"> <table border="1" cellpadding="2" cellspacing="1"> <tr> <td width="20%"> Â </title> <td width="80%"> <h2><xsl:value-of select="title"></h2> <h3><xsl:value-of select="author"></h3> <br>
<xsl:value-of select="body"> </td> </tr> </table> </xsl:template>
</xsl:stylesheet>';
$xmlData = ' <?xml version="1.0"?> <article> <title>Learning German</title> <author>Sterling Hughes</author> <body> Essential phrases: <br> <br> Komme sie mir sagen, woe die toilette es?<br> Eine grande beer bitte!<br> Noch einem bitte.<br> </body> </article>';
if (xslt_process($xslData, $xmlData, $result)) { echo "Here is the brilliant in-depth article on learning"; echo " German: "; echo "<br>\n<br>"; echo $result; } else { echo "There was an error that occurred in the XSL transformace...\n"; echo "\tError number: " . xslt_errno() . "\n"; echo "\tError string: " . xslt_error() . "\n"; exit; } ?>
|
|