RE: [PHP-WIN] "xml + xsl to html" sample code
| From: | Phillip Fox | Date: | Mon, 12 Feb 2001 18:26:29 +0000 |
| Subject: | RE: [PHP-WIN] "xml + xsl to html" sample code | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-5531@lists.php.net to get a copy of this message | ||
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 -- Phill@TheWorxCo.Net
405.773.WORX -- 1.888.772.WORX -- http://www.TheWorxCo.Net/
> -----Original Message-----
> From: Antonio Lopez [mailto:alopez@ingenia.es]
> Sent: Monday, February 12, 2001 10:07 AM
> To: php-windows@lists.php.net
> 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: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>