Results 1 to 3 of 3

Thread: Help! undefined function xslt_create()

  1. #1
    Join Date
    May 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Help! undefined function xslt_create()

    Hi,

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

    Below is my php source code:

    PHP Code:
    <?php
     
    // 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
     
    xslt_free($xsltproc);

     
    // 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!

  2. #2
    Join Date
    Jul 2008
    Posts
    199
    Thanks
    6
    Thanked 58 Times in 57 Posts

    Default

    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.

  3. #3
    Join Date
    May 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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!

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

    docbook.xsl
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
     <xsl:output method="html"/>
    
     <xsl:template match="article">
       <html>
       <head>
         <title><xsl:value-of select="title"/></title>
       </head>
       <body>
         <h1><xsl:value-of select="title"/></h1>
         <xsl:apply-templates select="section"/>
       </body>
       </html>
     </xsl:template>
    
     <xsl:template match="section">
       <xsl:apply-templates/>
       <hr/>
     </xsl:template>
    
     <xsl:template match="section/title">
       <h2><xsl:apply-templates/></h2>
     </xsl:template>
    
     <xsl:template match="para">
       <p><xsl:apply-templates/></p>
     </xsl:template>
    
     <xsl:template match="itemizedlist">
       <ul><xsl:apply-templates/></ul>
     </xsl:template>
    
     <xsl:template match="listitem">
       <li><xsl:apply-templates/></li>
     </xsl:template>
    </xsl:stylesheet>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •