In <[EMAIL PROTECTED]>, Vikram Vaswani wrote: There is an undocumented function in php4.0.6 that allows you to specify an XSLT callback function for errors. You can then create a function to parse out the error array created by the callback function. It actually captures not only errors but also acts to log the work of the underlying XSLT processor.
the function is xsl_set_error_handler and has parameters of 1) the XSLT processor instance and 2) A string representing the callback function name. e.g. xslt_set_error_handler($this->xslth,"XSLT_ErrorHandler"); Here is a sample of the callback function i have. Using the base php fuction error_log, you get the logging you want as well. function XSLT_ErrorHandler($parser, $code, $level, $errors) { if ($errors["msgtype"] == "log") { error_log(getNiceTime()."XSLT Status Code: $code\n",3,XSLT_LOG); error_log(getNiceTime()."XSLT Status Level: $level\n",3,XSLT_LOG); error_log(getNiceTime()."XSLT Status: {$errors['msg']}\n",3,XSLT_LOG); } else if ($errors["msgtype"] == "error") { error_log(getNiceTime()."XSLT Error Code: $code\n",3,XSLT_ERROR_LOG); error_log(getNiceTime()."XSLT Error Level: $level\n",3,XSLT_ERROR_LOG); error_log(getNiceTime()."XSLT Error FILE: {$errors['URI']}\n",3,XSLT_ERROR_LOG); error_log(getNiceTime()."XSLT Error LINE: {$errors['line']}\n",3,XSLT_ERROR_LOG); error_log(getNiceTime()."XSLT Error: {$errors['msg']}\n",3,XSLT_ERROR_LOG); } } Jeff > Hi all, > > I am working with the XSLT functions in PHP 4.0.6. I'm trying to trap > errors with the xslt_error() functions - however, the function generates > no output even if I deliberately introduce errors into the XSLT sheet. > > Same goes for the openlog() function. Anyone have any ideas how I can > use these to generate and log errors? > > TIA, > > Vikram -- PHP General 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]