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



Generally you don't infer XSD from XSL. You just write an XSD based on
what you expect as the output of the application of the XSL stylesheet.
XSD is fairly flexible in that it can be as strict or loose as you like.
I doubt it's possible to only apply the XSD in the case where the error,
otherwise you wouldn't be asking the question on the mailing list. But
maybe you could do some profiling and see whether applying an XSD to
every outcome is as slow as you suspect. 

 - Anthony

On Tue, 2008-04-15 at 14:29 +0200, Stefan Behnel wrote:
> 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
> 
> _______________________________________________
> 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]