RE: [xslt] stylesheet.errors



> > I'd like to have two more accessors in the python bindings:
> > stylesheet.error and stylesheet.warnings. 
> > It's the only way I found to find out
> > if a stylesheet compilation succeeded.
> 
>   Hum, if it fails you will get None.
>
> > I attached a patch proposal.
> 
>   I don't really understand you suggestion, if you want a abinary
> answer then (result == None) is the one. If you want to get the
> error/warning messages then this should not be a Get functions but
> Set functions. So can you explain a bit, I'm lost,
> 

Well, I tested first with a stylesheet containing some
<xsl:unknown/> element and parseStylesheetDoc returned
a stylesheet object that was not None. I later found out that 
the errors where actually warnings and that libxslt 
considered the stylesheet as correct.

In the meantime, I looked at xsltproc.c and found out
that it checked the errors field in addition to checking
that xsltParseStylesheetDoc did not return null 
(around line 770), so I supposed I needed access to
that field to detect compilation errors.

Now if you tell me that it will always be None in case
of errors, that's what I need.

Btw, to get the error messages, I assume I need to use the
global error handler, since there is no "compilation
context", right?

-sbi




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