The Article on PHP Builder is a great introduction to the XSL functions, but the 
sample code uses file pointers instead of strings. Just this weekend I created the 
following code based on the PHP sample:

        $templateXSL = "d:/xml/filename.xsl"

        // load the xls file as a string
        $fp = fopen($templateXSL,"r");
                if($fp) {
                        // get length
                        if (getType($fp) == 'file') {
                                $length = filesize($templateXSL());
                        }  else {
                                $length = 1000000;
                        }
                        $xslData = (fread($fp,$length));
                } else {
                        return 0;
                }

        if (xslt_process($xslData, $xmlString, $result)) {
                echo $result;
        } else {
                echo "There was an error that occurred in the XSL 
transformation...\n";
                echo "\tError number: " . xslt_errno() . "\n";
                echo "\tError string: " . xslt_error() . "\n";
        }

Hope that helps!
 
 --> Phillip Fox -- [EMAIL PROTECTED]
      405.773.WORX -- 1.888.772.WORX  --  http://www.TheWorxCo.Net/ 

> -----Original Message-----
> From: Antonio Lopez [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 12, 2001 10:07 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] "xml + xsl to html" sample code
> 
> 
> 
> I need a sample code of a php that has a xml string, a xsl string, and
> generates
> html output.
> 
> I've seen the php.net manual sample, but doesn't work correctly !!!.
> 
> 
> Thank you for your help!!!
> 
> 
> 
> 
> 
> ===================================================
> Antonio López Luna
> Ingeniería e Integración Avanzadas (Ingenia), S.A.
> Parque Tecnológico de Andalucía
> 29590  - Málaga (Spain)
>   
> Tel. 34-952029300 Ext. 386
> Fax. 34-952029309
> Web: http://www.ingenia.es
> 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: 
> [EMAIL PROTECTED]
> 

Reply via email to