I got some xml working, but when I try to style it using xsl I'm getting this error:
Fatal error: Call to undefined function xslt_create() in K:\xampp\htdocs\hudzilla\xml\xslt.php on line 2
Here's the code:
xslt.php:
- Code: Select all
<?php
$xsltproc=xslt_create();
$xslt_result = xslt_process($xsltproc,'xml\\news.xml','xml\\input.xsl');
xslt_free($xsltproc);
?>
<p>Processing XML and XSLT</p>
<?php
print $xslt_result;
?>
xml\input.xsl:
- Code: Select all
<?xmlversion="1.0"encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://my.netscape.com/rdf/simple/0.9/">
<xsl:output method="html" indent="no" encoding="utf-8"/>
<xsl:template match="/">
<html>
<head>
<title>XSLT</title>
</head>
<body>
<xsl:for-each select="/channel/item">
News Item: <xsl:value-of select="title"/><BR/>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
xml\news.xml
- Code: Select all
<?xml version="1.0"?>
<newsitems>
<news type="programming">
PHP 6.0 has been released!
</news>
<news type="programming">
Larry Wall switches to PHP!
</news>
<news type="sci-tech">
Woman lands on Mars!
</news>
<news type="programming">
XML takes over world!
</news>
</newsitems>
I've noticed the following section in php.ini:
- Code: Select all
;extension=php_win32std.dll
;extension=php_xdebug.dll
;extension=php_xmlreader.dll
extension=php_xmlrpc.dll
;extension=php_xmlwriter.dll
extension=php_xsl.dll
;extension=php_yaz.dll ; Module make problems
extension=php_zip.dll
;extension=php_zlib_filter.dll
Thanks in advance