sullivans Posted May 21, 2007 Share Posted May 21, 2007 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. Quote Link to comment Share on other sites More sharing options...
sullivans Posted May 22, 2007 Author Share Posted May 22, 2007 See here for solution: http://forums.devnetwork.net/viewtopic.php?p=383407#383407 (I hate finding threads with no answers on google searches) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.