Re: [xslt] xslt error message
- From: "Kaarle Kaila" <kaarle kaila fi>
- To: "The Gnome XSLT library mailing-list" <xslt gnome org>
- Subject: Re: [xslt] xslt error message
- Date: Wed, 28 Dec 2005 21:36:40 +0200
hi again,
I have not received any ideas from the list but continued digging and
googleing and came with an answer that prints a lot of error texts to e.g.
a log file. Just in case some else too needs this I'll post my solution
here. I have added a method and modified the code like this. Is there
void xmlMyErrorFunc(void * ctx, const char * msg,...){
// Get # of %-signs in msg and use that to get that many void* parameters
using macros
va_list marker;
va_arg( marker, void *);
va_end( marker );
I did not find any good way to know how many parameters I need? What if msg
contains %%?
// use sprintf to get the resulting text and write to log.
}
-------------
The code below I modified to look something like this:
ctxt = xsltNewTransformContext(cur, doc);
if (ctxt == NULL) {
ASSERT(FALSE);
return;
}
xsltSetGenericErrorFunc(ctxt,xmlMyErrorFunc); // This directs errors to
above method. I don't know where the errors went before.
res = xsltApplyStylesheetUser(cur,doc,pars,NULL,NULL,ctxt);
if (res == NULL) {
// Write error remark telling the user to have a look at tge log
return "";
}
---------------------------------
> hi,
>
> I cannot get an error message from libxslt. I would be very gratefull for
> some advice in this!
>
> I have this code:
> ------------
> res = xsltApplyStylesheet(cur,doc,pars);
> if (res == NULL) {
>
>
> xmlErrorPtr errx;
> errx = xmlGetLastError();
> ...................
> }
>
> --------
> It works ok as long as the transformation succeeds but when an error
occurs
> in the transformation
> then the function xsltApplyStylesheet returns NULL
> and also xmlGetLastError() returns NULL and I don't get any error message.
>
> Is there a function liks xsltGetLastError() or how should I be abel to
> display the reson of the failure??
>
> regards
> Kaarle Kaila
>
> _______________________________________________
> xslt mailing list, project page http://xmlsoft.org/XSLT/
> xslt gnome org
> http://mail.gnome.org/mailman/listinfo/xslt
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]