Hi,
I am using PHP 4.3.0RC3 and am having trouble using the xslt_process command. It works fine with small amounts of XML data (<100K) but above that is starts to crash. The OS is Windows XP Pro. Under Win98 it works fine. The message at times is msvcrt.dll causing GPF with php.exe, other times its sablot.dll causing GPF with php.exe. The file will display fine but when i reload it with different sort options it crashes.
The XSLT file is loaded into PHP and modified according to certain parameters passed to the script. The XML file is passed as a file reference and changes depending on what the user selects from a Select box. Attached below is a sample of the code and then a sample XSLT file and XML file.
Just a quick note: This code is being ran of a CD using PHP as a CGI and Xitami as the webserver. There is a VB program controlling Xitami and launching the default browser to connect to it. It works fine on Win98 but not on win2k and XP. The file that is causing the problem is 22119 lines long and the other one is only 8510 lines.
An online demo of the program can be found at http://www.wabusinessnews.com.au/bol/
PHP xslt_process code
$xsl=file_get_contents($_ENV["DOCUMENT_ROOT"]."/bol.xsl");
$xml=$_ENV["DOCUMENT_ROOT"]."/main_data/$list.xml";
#... code to modify XSL file and remove keyword and replace with XSL code.
$arguments = array('/_xsl' => $xsl);
$xh = xslt_create();
$result = xslt_process($xh, 'file://'.$xml, 'arg:/_xsl', NULL, $arguments);
#... code to modify result via regular expressions
print $result;
xslt_free($xh);
XSLT file after mods by PHP code
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="HTML" encoding="US-ASCII"/>
<xsl:template match="/">
<xsl:for-each select="BOL/List[@name='Public Company']/Company_Details">
<xsl:sort select="Phone" data-type="text" order="ascending"/>
<tr>
<xsl:if test="(position() mod 2 = 1)">
<xsl:attribute name="bgcolor">#FFFFFF</xsl:attribute>
</xsl:if>
<xsl:if test="(position() mod 2 = 0)">
<xsl:attribute name="bgcolor">#CADDFF</xsl:attribute>
</xsl:if>
<td class="border_right">
<b>2003: <xsl:value-of select="Current_Rank"/></b><br/>
<span class="02rank">2002: <xsl:value-of select="Previous_Rank"/></span>
</td>
<td>
<b><xsl:value-of select="Company_Name"/></b><br/>
<xsl:value-of select="ancestor::List/@name"/>
</td>
<td>
<xsl:value-of select="Street_Address_1"/><br/>
<xsl:value-of select="Street_Address_2"/><br/>
<xsl:value-of select="Suburb"/>
<xsl:value-of select="State"/>
<xsl:value-of select="Pcode"/>
</td>
<td><xsl:value-of select="Email"/></td>
<td><xsl:value-of select="WebSite"/></td>
<td>
Ph: <xsl:value-of select="Phone"/><br/>
Fx: <xsl:value-of select="Fax"/>
</td>
<td>
<a>
<xsl:attribute name="href">javascript:;</xsl:attribute>
<xsl:attribute name="onClick">MM_openBrWindow('extradetails.php?company_name=<xsl:value-of select="Company_Name"/>*Listurl*','','scrollbars=yes,width=415,height=500');</xsl:attribute>
View
</a>
</td>
</tr>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Sample of Data in XML file
<BOL>
<List name="Public Company">
<Company_Details>
<Company_Name_Caps>MY CASINO LIMITED</Company_Name_Caps>
<Company_Name>My Casino Limited</Company_Name>
<Street_Address_1>MEZZANINE LEVEL</Street_Address_1>
<Street_Address_2>BGC CENTRE, 28 THE ESPLANADE</Street_Address_2>
<Suburb>PERTH</Suburb>
<Pcode>6000</Pcode>
<Postal_Address_1>MEZZANINE LEVEL</Postal_Address_1>
<Postal_Address_2>BGC CENTRE, 28 THE ESPLANADE</Postal_Address_2>
<Postal_Suburb>PERTH</Postal_Suburb>
<Postcode>6000</Postcode>
<State>WA</State>
<Email>my-casino@my-casino.com.au</Email>
<WebSite>www.my-casino.com.au</WebSite>
<Phone>08 9481 1525</Phone>
<Fax>08 9481 2394</Fax>
<Current_Rank>288</Current_Rank>
<Previous_Rank>141</Previous_Rank>
<Contacts>
<Contact>
<Name>Mr Jonathan Asquith</Name>
<Position>Company Secretary</Position>
<DirectEmail></DirectEmail>
</Contact>
<Contact>
<Name>Mr Hans-Rudolf Moser</Name>
<Position>Director</Position>
<DirectEmail></DirectEmail>
</Contact>
<Contact>
<Name>Mr Michael O'Donnell</Name>
<Position>Chairman</Position>
<DirectEmail></DirectEmail>
</Contact>
<Contact>
<Name>Ms Patrizia Koenig</Name>
<Position>Director</Position>
<DirectEmail></DirectEmail>
</Contact>
<Contact>
<Name>Mr Amelia Matousis</Name>
<Position>Director</Position>
<DirectEmail></DirectEmail>
</Contact>
</Contacts>
</Company_Details>
<Company_Details>
<Company_Name_Caps>ACCLAIM EXPLORATION NL</Company_Name_Caps>
<Company_Name>Acclaim Exploration NL</Company_Name>
<Street_Address_1>704 MURRAY STREET</Street_Address_1>
<Street_Address_2></Street_Address_2>
<Suburb>WEST PERTH</Suburb>
<Pcode>6005</Pcode>
<Postal_Address_1>PO BOX 513</Postal_Address_1>
<Postal_Address_2></Postal_Address_2>
<Postal_Suburb>SUBIACO</Postal_Suburb>
<Postcode>6008</Postcode>
<State>WA</State>
<Email>aex@acclaimexploration.com.au</Email>
<WebSite>www.acclaimexploration.com.au</WebSite>
<Phone>08 9226 5811</Phone>
<Fax>08 9226 5822</Fax>
<Current_Rank></Current_Rank>
<Previous_Rank>301</Previous_Rank>
<Contacts>
<Contact>
<Name>Mr Brett Matich</Name>
<Position>Managing Director</Position>
<DirectEmail></DirectEmail>
</Contact>
<Contact>
<Name>Mr Neville Bassett</Name>
<Position>Company Secretary and Non-Executive Director</Position>
<DirectEmail></DirectEmail>
</Contact>
<Contact>
<Name>Mr Edward Eshuys</Name>
<Position>Chairman</Position>
<DirectEmail></DirectEmail>
</Contact>
<Contact>
<Name>Mr Greg Wheeler</Name>
<Position>Chairman</Position>
<DirectEmail></DirectEmail>
</Contact>
</Contacts>
</Company_Details>
<Company_Details>
<Company_Name_Caps>ORCHID CAPITAL LIMITED</Company_Name_Caps>
<Company_Name>Orchid Capital Limited</Company_Name>
<Street_Address_1>LEVEL 5, MLC HOUSE</Street_Address_1>
<Street_Address_2>1100 HAY STREET</Street_Address_2>
<Suburb>WEST PERTH</Suburb>
<Pcode>6005</Pcode>
<Postal_Address_1>LEVEL 5, MLC HOUSE</Postal_Address_1>
<Postal_Address_2>1100 HAY STREET</Postal_Address_2>
<Postal_Suburb>WEST PERTH</Postal_Suburb>
<Postcode>6005</Postcode>
<State>WA</State>
<Email>info@orchidcapital.net</Email>
<WebSite>www.orchidcapital.net</WebSite>
<Phone>08 9321 3664</Phone>
<Fax>08 9322 6887</Fax>
<Current_Rank>210</Current_Rank>
<Previous_Rank>186</Previous_Rank>
<Contacts>
<Contact>
<Name>Mr Clive McKee</Name>
<Position>Managing Director</Position>
<DirectEmail></DirectEmail>
</Contact>
<Contact>
<Name>Mr Alvin Tan</Name>
<Position>Executive Director</Position>
<DirectEmail></DirectEmail>
</Contact>
<Contact>
<Name>Mr Stephen Baxter</Name>
<Position>Non-Executive Director</Position>
<DirectEmail></DirectEmail>
</Contact>
<Contact>
<Name>Mr Norman Grafton</Name>
<Position>Finance Director and Company Secretary</Position>
<DirectEmail></DirectEmail>
</Contact>
<Contact>
<Name>Mr Ross Kestel</Name>
<Position>Non-Executive Chairman</Position>
<DirectEmail></DirectEmail>
</Contact>
</Contacts>
</Company_Details>
</List>
</BOL>