Bug #10569 Updated: xslt_error handling
| From: | sterling@php.net | Date: | Mon, 30 Jul 2001 22:32:54 +0000 |
| Subject: | Bug #10569 Updated: xslt_error handling | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-61597@lists.php.net to get a copy of this message | ||
ID: 10569
Updated by: sterling
Reported By: msopacua@idg.nl
Old Status: Open
Status: Closed
Bug Type: Sablotron XSL
Operating System: BSD
PHP Version: 4.0.4pl1
New Comment:
1. Your attitude won't get you anywhere
2. The new extension doesn't throw fatal errors and
provides ample error handling (--enable-xslt
--with-xslt-sablot).
Previous Comments:
------------------------------------------------------------------------
[2001-04-30 19:37:41] msopacua@idg.nl
Hi,
again - the error handling issue.
I read the closed bugs and am surprised at the speed at which they are closed.
First of all - a documentation issue:
xslt_set_error_handler isn't documented. Thank you for mentioning it briefly, and then letting
me figure out the arguments the called function needs.
Secondly - dying with a Fatal error, DOES occur, when the error handler isn't set! Even when
using @xslt_process.
Try this one:
<?php
$xslData = '<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="article">
<table border="1" cellpadding="2" cellspacing="1">
<tr>
<td width="20%">
 
</td>
<td width="80%">
<h2><xsl:value-of select="title"/></h2>
<h3><xsl:value-of select="author"/></h3>
<br/>
<xsl:copy-of select="p"/>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>';
$xmlData = '<?xml version="1.0"?>
<article>
<title>Learning German</title>
<author>Sterling Hughes</author>
<p>
Essential phrases:
<br>
Können Sie mir sagen, wo die Toilette ist?<br/>
Ein grosses Bier, bitte!<br/>
Noch eins, bitte.<br/>
</p>
</article>';
function xsl_error($errno, $errstr)
{
echo "\$errorstr: $errstr<BR>";
return false;
}
//xslt_set_error_handler("xsl_error");
if (@xslt_process($xslData, $xmlData, $result)) {
echo "Here is the brilliant in-depth article on learning";
echo " German: ";
echo "<br>\n<br>";
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";
//exit;
}
?>
</BODY>
</HTML>
You won't see the closing body and html tags.
Uncommenting the xslt_set_error_handler() will. The errorstr output, however - is numeric.
So can we at least have updated documentation on how to trap errors? And how
xslt_set_error_handler() must be used?
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=10569&edit=1