Hi Alain,

Want to share an observation and possible improvement to the xsltforms code.

In XsltForms v1.0, when a binding expression on a bound element X in the form 
references no node(s), descendant bound elements seem to be evaluated with the 
same in-scope evaluation context as that of X, whereas according to the XForms 
spec, binding expressions of descendant bound elements should not be evaluated 
at all in such situations.

While it may seem that this is not an important issue, since element X and 
descendant elements will be marked as disabled anyway, it may happen (and it 
did so in my form) that XsltForms throws errors/exceptions during build/refresh 
processing of nested bound elements when their binding expressions are 
evaluated in an unexpected in-scope evaluation context.

I found that it may be possible to fix this issue with the following 
modifications in the definition of the function XsltForms_globals.build():

1) replace the line:

var newctx = element.node || ctx;

with:

var newctx = (hasXFElement && xf.hasBinding && !element.node ? null : 
element.node || ctx);

... in order to pass an in-scope evaluation context with no context item 
instead of the current context item to the processing of descendant controls if 
the current element's binding expressions references no node.

2) insert the lines:

if (hasXFElement && xf.hasBinding && !ctx) {
return {ctx: ctx, hasXFElement: hasXFElement};
}

...towards the top of the function body in order to skip build processing of 
bound elements whose in-scope evaluation context contains no context item.

/ Mats

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support

Reply via email to