View Full Version : Help! undefined function xslt_create()

07-28-2008, 07:08 AM

I create a simple php file and try to run it. But i get an error to it.

Below is my php source code:

// Create an XSLT processor
$xsltproc = xslt_create();

// Perform the transformation
$html = xslt_process($xsltproc, 'docbook.xml', 'docbook.xsl');

// Detect errors
if (!$html) die('XSLT processing error: '.xslt_error($xsltproc));

// Destroy the XSLT processor

// Output the resulting HTML
echo $html;

When i tried to run this script, i get an error as shown in below:

Fatal error: Call to undefined function xslt_create() in C:\Program Files\EasyPHP 2.0b1\www\xsl\docbook.php on line 3

I don't know how to solve this. Any else can help me?

Thank you very much!

07-28-2008, 12:19 PM
Since this has no longer been bundled with PHP as of PHP5, meaning you'll have to install it manually.

The PHP website recommends if you need xslt support, to use the xsl extension (http://php.net/manual/en/book.xsl.php).

07-29-2008, 02:25 AM
Hi techietim,

Thanks for your reply. There are not any error occur again.

But, i didn't to see any output when i run it. It just shown a white blank. What's wrong i make?

Below is my xml and xsl code. Hope can help! Thank you very much!


<?xml version="1.0" encoding="UTF-8"?>
<title>A Sample Article</title>
<title>Article Section 1</title>
This is the first section of the article. Nothing terribly
interesting here, though.
<title>Another Section</title>
Just so you can see how these things work, here's an
itemized list:
<para>The first item in the list</para>
<para>The second item in the list</para>
<para>The third item in the list</para>


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"

<xsl:output method="html"/>

<xsl:template match="article">
<title><xsl:value-of select="title"/></title>
<h1><xsl:value-of select="title"/></h1>
<xsl:apply-templates select="section"/>

<xsl:template match="section">

<xsl:template match="section/title">

<xsl:template match="para">

<xsl:template match="itemizedlist">

<xsl:template match="listitem">