RE: [xslt] Non-existent variable => error?

>> Eh? May the Lord strike me down if I understod what you mean :-)
>> I thought the documentation pretty clear. If an error occurs
>> during its execution,
> the
>> function will return NULL.
> Grumpy today Igor?  Running this stylesheet returns output (see
> his original message).
>> > and the handler set by xsltSetGenericErrorFunc
>> > (unfortunately a global....) is the only way to know
>> > if an error actually occurred?
>> No, precisely the fact that the function returned NULL is
>> telling you that an error has occured.
> It did not return NULL, it returned the result document up to the
> point of the error occurring, i.e.

Well, let's back up just a little....  First, the documentation.  My
interpretation of its words of wisdom is that if you really screw
up, like give it a pointer that points to a letter from your aunt
Martha instead of a nice XML document, and it can't reply with a
valid document, then it has every right to reply with a NULL
pointer.  It specifically *doesn't* mean that you haven't made any
mistake anywhere, or that your stylesheet is error-free.

Next the philosophy.  There are many ways of dealing with an error. 
One of my favourites is to crash and burn exactly at the point of
the error.  Another of my favourites is to produce a rude error
message to the user, pick up your toys, and go home.  Unfortunately,
users tend not to enjoy either of these approaches, so
libxml/libxslt instead go as far as they can, finding as many
different errors as possible, and producing the most meaningful
output they can within this hostile (user) environment.  By default,
error messages are sent to stderr.  If you don't like this, there
are many other options available.  But, in any event, the error
*has* been notified [which was the point of my initial response]. 
What the user chooses to do with that notification is up to him (or,
as Igor would say, up to her).

Now, Jerome, if you feel the documentation is inadequate, make a
positive suggestion for it's enhancement - I guarantee you John
Fleck or others will take it to heart, and do their best to improve
it.  But please, don't report that libxslt allows erroneous
stylesheets to go by "silently".


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]