xslt_error
(PHP 4 >= 4.0.3)
xslt_error — Returns an error string
Описание
string xslt_error
( resource $xh
)
Returns a string describing the last error that occurred on the passed XSLT processor.
Возвращаемые значения
Returns the error message, as a string.
Примеры
Пример #1 Handling errors using the xslt_error() and xslt_errno() functions.
<?php
$xh = xslt_create();
$result = xslt_process($xh, 'dog.xml', 'pets.xsl');
if (!$result) {
die(sprintf("Cannot process XSLT document [%d]: %s",
xslt_errno($xh), xslt_error($xh)));
}
echo $result;
xslt_free($xh);
?>
[an error occurred while processing the directive]
- xslt_backend_info
- xslt_backend_name
- xslt_backend_version
- xslt_create
- xslt_errno
- xslt_error
- xslt_free
- xslt_getopt
- xslt_process
- xslt_set_base
- xslt_set_encoding
- xslt_set_error_handler
- xslt_set_log
- xslt_set_object
- xslt_set_sax_handler
- xslt_set_sax_handlers
- xslt_set_scheme_handler
- xslt_set_scheme_handlers
- xslt_setopt
Коментарии
There may be cases where a null $result is legitimate, in this case add a test for non-zero xlst_errno:
<?php
$xh = xslt_create();
$result = xslt_process($xh, 'dog.xml', 'pets.xsl');
if (!$result && xslt_errno($xh) > 0) {
die(sprintf("Cannot process XSLT document [%d]: %s",
xslt_errno($xh), xslt_error($xh)));
}
echo $result;
xslt_free($xh);
?>