orbeon / orbeon-forms

Orbeon Forms is an open source web forms solution. It includes an XForms engine, the Form Builder web-based form editor, and the Form Runner runtime.
http://www.orbeon.com/
GNU Lesser General Public License v2.1
517 stars 221 forks source link

Can only xxf:set-session-attribute() with a string #5195

Open ewg118 opened 2 years ago

ewg118 commented 2 years ago

I have deployed the Orbeon 2021.1 CE to a new server to begin migrating my applications and have come across an issue with xxf:set-session-attribute().

My previous code populated the session attribute with the value from an instance:

<xforms:insert context="." origin="xxf:set-session-attribute('collection-name', instance('control-instance')/collection-name)"/>

But this no longer functions. I replaced instance('control-instance')/collection-name) with a hard-coded string, and it does work as intended. I also tried replacing instance('control-instance')/collection-name) with an xforms:variable, $name, but the session attribute won't set from a variable either.


Upon further testing, if you wrap the instance reference or the variable with string(), it will work. It should also be noted that this only functions with the xxf: prefix. The old xxforms: prefix results in an error. Maybe everyone else already migrated to xxf: years ago.

ebruchez commented 2 years ago

Regarding the namespace prefix: any prefix should work as namespace mappings are not hardcoded but in-scope namespaces are used. Not sure what's happening here.

ebruchez commented 2 years ago

This might have regressed with 59fa9e30dac691bcdd2d095792dd289786033a42. What version did you migrate from, @ewg118?

ewg118 commented 2 years ago

Quite an old one, it looks. orbeon-2018.1.1

ebruchez commented 2 years ago

Then it could also be with 4df0d4125eb13fc09f2a91365f0b47cf9c8b370a.

The "current" behavior is that if you pass an XML node to the function, it stores an XML tree in the session. If you want to store a string, you can be explicit with :

string(instance('control-instance')/collection-name)