Jump to content

Can't get libxslt support with php5 and apache2


Recommended Posts

I've uncommented extension=php_xsl.dll and extension=php_xslt.dll in php.ini (located in c:\windows). In the same file I set extension_dir to "C:\Program Files\PHP\ext". In the directory C:\Program Files\PHP\ext I have libexslt.dll, libexslt.exp, libexslt.lib,libexslt_a.lib, libxml2.dll, libxml2.exp, libxml2.lib, libxml2_a.lib, libxslt.dll, libxslt.exp, libxslt.lib, libxslt_a.lib, php_xsl.dll, and php_xslt.dll. This "should" be my extensions directory.

 

Now that should be my extensions directory. Yet for some reason when I do phpinfo() in a test php page xsl or libxslt doesn't even show up in the output. However libxml does. I just can't seem to figure out how to get libxslt support with php and apache. I'm pretty sure my code is correct; when I run it I just get a blank white screen. I'll show you my xml, xsl, and php file just in case anyways:

 

order.xml:

<?xml version="1.0" ?>
<Order>
  <Account>9900234</Account>
  <Item id="1">
    <SKU>1234</SKU>
    <PricePer>5.95</PricePer>
    <Quantity>100</Quantity>
    <Subtotal>595.00</Subtotal>
    <Description>Super Widget Clamp</Description>
  </Item>
  <Item id="2">
    <SKU>6234</SKU>
    <PricePer>22.00</PricePer>
    <Quantity>10</Quantity>
    <Subtotal>220.00</Subtotal>
    <Description>Mighty Foobar Flange</Description>
  </Item>
  <Item id="3">
    <SKU>9982</SKU>
    <PricePer>2.50</PricePer>
    <Quantity>1000</Quantity>
    <Subtotal>2500.00</Subtotal>
    <Description>Deluxe Doohickie</Description>
  </Item>
  <Item id="4">
    <SKU>3256</SKU>
    <PricePer>389.00</PricePer>
    <Quantity>1</Quantity>
    <Subtotal>389.00</Subtotal>
    <Description>Muckalucket Bucket</Description>
  </Item>
  <NumberItems>1111</NumberItems>
  <Total>3704.00</Total>
  <OrderDate>07/07/2002</OrderDate>
  <OrderNumber>8876</OrderNumber>
</Order>

order.xsl:

<?xml version="1.0"  ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:param name="column" select="'SKU'"/>
<xsl:param name="order" select="'ascending'"/>
  <xsl:template match="/">
    <html>
      <body>
        <xsl:apply-templates select="Order">
          <xsl:with-param name="sortcolumn" select="$column" />
          <xsl:with-param name="sortorder" select="$order" />
        </xsl:apply-templates>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="Order">
    <xsl:param name="sortcolumn" />
    <xsl:param name="sortorder" />
    <table border="1">
      <tr>
        <th>Account</th>
        <th>SKU</th>
        <th>Description</th>
        <th>Price</th>
        <th>Quantity</th>
        <th>Subtotal</th>
      </tr>
      <xsl:apply-templates select="Item">
        <xsl:sort select="*[name()=$sortcolumn]"  order="{$sortorder}" />
      </xsl:apply-templates>
    </table>
  </xsl:template>

  <xsl:template match="Item">
    <tr>
      <td><xsl:value-of select="../Account" /></td>
      <td><xsl:value-of select="SKU" /></td>
      <td><xsl:value-of select="Description" /></td>
      <td><xsl:value-of select="PricePer" /></td>
      <td><xsl:value-of select="Quantity" /></td>
      <td><xsl:value-of select="Subtotal" /></td>
    </tr>
  </xsl:template>    
</xsl:stylesheet>
<?xml version="1.0"  ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:param name="column" select="'SKU'"/>
<xsl:param name="order" select="'ascending'"/>
  <xsl:template match="/">
    <html>
      <body>
        <xsl:apply-templates select="Order">
          <xsl:with-param name="sortcolumn" select="$column" />
          <xsl:with-param name="sortorder" select="$order" />
        </xsl:apply-templates>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="Order">
    <xsl:param name="sortcolumn" />
    <xsl:param name="sortorder" />
    <table border="1">
      <tr>
        <th>Account</th>
        <th>SKU</th>
        <th>Description</th>
        <th>Price</th>
        <th>Quantity</th>
        <th>Subtotal</th>
      </tr>
      <xsl:apply-templates select="Item">
        <xsl:sort select="*[name()=$sortcolumn]"  order="{$sortorder}" />
      </xsl:apply-templates>
    </table>
  </xsl:template>

  <xsl:template match="Item">
    <tr>
      <td><xsl:value-of select="../Account" /></td>
      <td><xsl:value-of select="SKU" /></td>
      <td><xsl:value-of select="Description" /></td>
      <td><xsl:value-of select="PricePer" /></td>
      <td><xsl:value-of select="Quantity" /></td>
      <td><xsl:value-of select="Subtotal" /></td>
    </tr>
  </xsl:template>    
</xsl:stylesheet>

order.php:

<?php
$xmlfile = "order.xml";
$xslfile = "order.xsl";
$args = array("column"=>"Quantity", "order"=>"descending");
$engine = xslt_create();
$output = xslt_process($engine, $xmlfile, $xslfile, NULL, NULL, $args);
print $output;
xslt_free($engine);
?>

 

If anyone can tell me what I need to do to get php to work with xslt it would be greatly appreciated.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.