PHP+XML+XSL = непонятная проблема.
От: FilosOFF Россия  
Дата: 05.08.09 09:59
Оценка:
Доброго дня!
Пытаюсь разобраться с XSL преобразованием в PHP.
Установил пятый PHP подключил php_xsl.dll.
Скопипастил пример с нета:
$xmlData = '<?xml version="1.0" encoding="Windows-1251"?>
<document>
<game>
    <title>Railroad Tycoon II Platinum</title>
    <genre>экономическая стратегия</genre>
    <designer>PopTop software</designer>
    <publisher>G.O.D. games</publisher>
    <year>2001</year>
</game>
<game>
    <title>Grand Prix 4</title>
    <genre>автосимулятор</genre>
    <designer>Geoff Crammond & Simergy</designer>
    <publisher>Infogrames Entertainment</publisher>
    <year>2002</year>
</game>
</document>';

$xslData = '<?xml version="1.0" encoding="windows-1251"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" encoding="Windows-1251"/>

<xsl:template match="/">
    <xsl:apply-templates/>
</xsl:template> 

<xsl:template match="document">
    <html><head>
    <title>Игры</title>
    </head>
    <body>
    <h1>Игры</h1>
    <table cellpadding="2" cellspacing="2" border="1">
    <tr>
        <td>Название</td>
        <td>жанр</td>
        <td>год</td>
        <td>разработчик</td>
        <td>издатель</td>
    </tr>
        <xsl:apply-templates select="game"/>
    </table>
    </body></html>
</xsl:template> 

<xsl:template match="game">
    <tr>
        <td><b><xsl:value-of select="title"/></b></td>
        <td><xsl:value-of select="genre"/></td>
        <td><xsl:value-of select="year"/></td>
        <td><xsl:value-of select="designer"/></td>
        <td><xsl:value-of select="publisher"/></td>
    </tr>
</xsl:template> 

</xsl:stylesheet>';

$xh = xslt_create();

    $arguments = array(
        '/_xml' => $xmlData,
        '/_xsl' => $xslData
    ); 

    $result = @xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments);
    

if ($result)
    print ($result);
else {
    print ("There was an error that occurred in the XSL transformation...\n");
    print ("\tError number: " . xslt_errno($xh) . "\n");
    print ("\tError string: " . xslt_error($xh) . "\n");
    exit;
}


Открываю страничку, вижу следующее:
There was an error that occurred in the XSL transformation... Error number: 7 Error string: ?

Собственно вопрос: Что делать, как быть?
... << RSDN@Home 1.2.0 alpha 4 rev. 1231>>
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.