Re: [xslt] Why is an invalid stylesheet parameter value not an error?



Anthony de Almeida Lopes top-posted:
> On Tue, 2008-04-15 at 13:56 +0200, Stefan Behnel wrote:
>> Vincent Lefevre wrote:
>>> On 2008-04-15 12:33:42 +0200, Stefan Behnel wrote:
>>>> What could be wrong in telling the user that he/she made a mistake
>>>> instead of hiding the problem that was discovered during XSLT
>>>> evaluation and that lead to an incorrect result?
>>> How can a XSLT processor read in the user's mind?
>> Well, it stops processing, so it's actually the XSLT processor that decides
>> that something has happened that does not allow it to continue its work
>> correctly. But then, it returns the half-completed result to the user as if
>> nothing unusual happened.
>>
>> Now, imagine the "user" is not a human being who knows how to read and
>> interpret text messages, but instead is a program that wants to know if the
>> result is the correct and complete result of the transformation, or if it
>> needs to do something special about it. I would like to know how to take
>> exactly this decision in a reasonably efficient way, without a major impact on
>> the error-free success case.
>
> You could always use an XSD to validate it after the XSLT processing.

Sure, if you tell me how to a) infer an XSD from an XSL stylesheet document
and b) do that only in the case that there actually *was* an error to avoid
the overhead of doing all that work in the error-free case.

lxml is a generic, feature-complete Python wrapper around libxml2/libxslt, so
I have to do this in the very general case of dealing with any stylesheet, any
input parameters and any input document.

Stefan



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