Popis
mixed
xslt_process ( resource xh, string xml, string xsl [, string result [, 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="http://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;
}
?> |
|