Кому интересно... HOWTO по прикручиванию libxslt для php4.0.6 win32

slach

Новичок
Кому интересно... HOWTO по прикручиванию libxslt для php4.0.6 win32

Прежде всего объявляется вечная благодарность su1d'у ;) за терпение и усидчивость... а также за то, что скомпилил php_gxslt под win32

1) качаем libxslt
http://www.fh-frankfurt.de/~igor/projects/libxml/data/libxml2-2.4.10.win32.zip
http://www.fh-frankfurt.de/~igor/projects/libxml/data/libxslt-1.0.7.win32.zip

2) качаем iconv
http://www.fh-frankfurt.de/~igor/projects/libxml/data/iconv-1.7.win32.zip

3) кладем libxslt.dll libexslt.dll libxml2.dll iconv.dll в c:\WinNT\system32\
4) туда же кладем xsltproc.exe (это аналог sabcmd.exe)

5) идем сюда http://www.e-taller.net/dev/gxslt/
и качаем zip файлик с extention

6) кладем php_gxslt.dll в c:/usr/local/php/extentions/

Тестовые файлы для проверки работоспособности...
====test.xml====
<?xml version="1.0" encoding="windows-1251"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<cookbook>

<recipe>
<name>Pasta Carbonara</name>
<difficulty>Easy</difficulty>
<time>25 minutes</time>
<rating>*****</rating>
<chef>Chef Michele</chef>
<comments>This delicious Italian dish consists of a blend
of pasta, bacon and eggs. Eat it morning, noon or &#160;
night! Єшяр ЄхёЄ ш тёх Єръюх... шэЄхЁхёэю </comments>
</recipe>
<recipe>
<name>La Bistecca</name>
<difficulty>Difficult</difficulty>
<time>35 minutes</time>
<rating>*****</rating>
<chef>Chef Nino</chef>
<comments>La Bistecca, Italian for 'steak', grilled tender
in the summertime is my favorite dish!</comments>
</recipe>
<recipe>
<name>Pollo fritto</name>
<difficulty>Difficult</difficulty>
<time>45 minutes</time>
<rating>*****</rating>
<chef>Chef Rita</chef>
<comments>Nothing says Italian like fried
chicken!</comments>
</recipe>
</cookbook>
====test.xml====

====test.xsl====
<?xml version="1.0" encoding="windows-1251"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:eek:utput encoding="windows-1251" method="html" />
<xsl:template match="/cookbook">

<head>
<title>What's Cooking at WebReview</title>
</head>
<body bgcolor="white" text="#000000" link="#ff8000"
vlink="#000000" alink="#ff0000">

<table bgcolor="white" border="0" cellpadding="0" cellspacing="0">
<xsl:call-template name="recipes"/>
</table>

</body>

</xsl:template>

<xsl:template name="recipes">
<xsl:for-each select="recipe">
<tr>
<td width="60%">
<font size="4"><xsl:value-of select="name"/>
</font>
<br/>
Rating: <xsl:value-of select="rating"/>
<br/>
Preparation time: <xsl:value-of select="time"/>
<br/>
Submitted By: <xsl:value-of select="chef"/>
<br/>
Level: <xsl:value-of select="difficulty"/>
<br/>
<xsl:value-of select="comments"/><br/>
<hr/>
</td>
</tr>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>
====test.xsl====

====libxslt.php====
PHP:
<?php
$xml_file = "test.xml";
$xsl_file = "test.xsl";

// Open each file and assign it to a filehandle.
$xml_handle = fopen($xml_file, "r") or die("Can't open XML file!");
$xsl_handle = fopen($xsl_file, "r") or die("Can't open XSL file!");
// Read in the file contents.
$xml_content = fread($xml_handle, filesize($xml_file));
$xsl_content = fread($xsl_handle, filesize($xsl_file));

$xsl_tfmtion= gxslt_process($xml_content, $xsl_content,'CP1251');

echo $xsl_tfmtion;

$fl=fopen('text.html','w');
fwrite($fl,$xsl_tfmtion);
fclose($fl);
// Free up the processor resources.


?>
====libxslt.php====
 
Сверху