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



According to the documentation
(http://xmlsoft.org/XSLT/html/libxslt-transform.html#XSLTAPPLYSTYLESHEET)

xsltApplyStylesheet
...
Returns : the result document or NULL in case of error


I guess this only means that 

return NULL => an error occurred 

but not

an error occurred => return NULL

and the handler set by xsltSetGenericErrorFunc
(unfortunately a global....) is the only way to know
if an error actually occurred?

Jerome

--- "William M. Brack" <wbrack@mmm.com.hk> wrote:
> Hi - I'm not quite sure where your problem is:-
> 
> bill@billrouter work $ xsltproc bug.xsl bug.xml
> runtime error: file bug.xsl line 5 element B
> unregistered variable foo
> xmlXPathCompiledEval: evaluation failed
> <?xml version="1.0"?>
> 
> foo<B span=""/>
> bill@billrouter work $ xsltproc --version
> Using libxml 20424, libxslt 10020 and libexslt 711
> xsltproc was compiled against libxml 20424, libxslt
> 10020 and
> libexslt 711
> libxslt 10020 was compiled against libxml 20424
> libexslt 711 was compiled against libxml 20424
> bill@billrouter work $ date
> Thu Oct  3 22:11:10 HKT 2002
> 
> Seems to me like "runtime error", "unregistered
> variable" and
> "evaluation failed" somehow don't agree with your
> assertion that
> xslt has "failed silently".
> 
> (sorry I'm not quite up to the the latest release -
> gentoo is a
> little slow :-)
> 
> Rgds,
> Bill
> 
> > Hi,
> >
> > The following style sheet:
> >
> > <xsl:stylesheet
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> > version="1.0">
> > <xsl:template match="/">
> > foo<B span="{$foo}"/>foo2
> > </xsl:template>
> > </xsl:stylesheet>
> >
> >
> > gives
> >
> > <?xml version="1.0"?>
> >
> > foo<B span=""/>
> >
> > (independently of the XML input....)
> >
> > without returning an error, i.e., it fails
> silently
> > after trying to evaluate the variable $foo which
> > hasn't been defined. Is that proper behavior? I
> would
> > have expected an error...
> >
> > Thanks!
> > Jerome Pesenti
> >
> > PS: I am using libxslt-1.0.19
> 
> 
> 
> _______________________________________________
> xslt mailing list, project page
> http://xmlsoft.org/XSLT/
> xslt@gnome.org
> http://mail.gnome.org/mailman/listinfo/xslt


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com



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