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,
> function will return NULL.

Grumpy today Igor?  Running this stylesheet returns output (see his original

> > 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.

C:\>xsltproc --verbose test.xsl test.xml
Added namespace: xsl mapped to
xsltPrecomputeStylesheet: removing ignorable blank node
xsltParseStylesheetProcess : found stylesheet
xsltCompilePattern : parsing '/'
xsltCompilePattern : parsed /, default priority 0.500000
added pattern : '/' priority 0.500000
parsed 1 templates
Resolving attribute sets references
Initializing keys on test.xml
Registered 0 modules
Registering global variables
Registering global variables from test.xsl
xsltProcessOneNode: applying template '/' for /
xsltApplyOneTemplate: copy text
xsltCopyText: copy text
xsltApplyOneTemplate: copy node B
Lookup variable foo
global variable not found foo
runtime error: file test.xsl line 5 element B
unregistered variable foo
xmlXPathCompiledEval: evaluation failed
xsltEvalXPathString: returns (null)
<?xml version="1.0"?>

foo<B span=""/>


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