With Orbeon Forms, I have a form which has embedded template (library) section. I would need to retrieve a value from a control in the main form to a control in the template section. I found some conversations about similar issues with the template sections.
This sounds essentially like the same case as I have: http://discuss.orbeon.com/Retrieve-value-outside-library-section-template-td4663317.html
The way it is suggested there did not work as expected. It is suggested to use function xxf:instance(), so for example xxf:instance('fr-form-instance')/mysection/mycontrol should work. However, I could not get the reference point outside the library section when I added such function to a control inside the library.
For debugging I ran command inside the library section control: saxon:serialize(xxf:instance('fr-form-instance'), 'xml')
. This returned me XML of only the section which contains only the library section part of the main form basically like this:
<library-section>
<grid>
<controlInLibrary>Control value blah blah</controlInLibrary>
</grid>
</library-section>
If I'll run the same command in the main form part, I'd get the whole form, library section included:
<form>
<another-section>
<grid-another>
<control1/>
<control2/>
</grid-another>
</another-section>
<library-section>
<grid>
<controlInLibrary>Control value</controlInLibrary>
</grid>
</library-section>
</form>
Obviously the example XMLs here are simplified.
How is this xxf:instance() function supposed to work to get data outside the library? What I might be doing wrong?
I got it working the opposite way (data from template section control to main form control) according to another thread, but that apparently does not work both ways: Orbeon Form Builder - Referring to a control within a Section Template
Got an answer to this from Orbeon support elsewhere. The working solution at least in my case is that the function is formed like this:
xxf:instance('|fr-form-instance|')//outer-field
(With //outer-field obviously being the reference to the desired control on the main form.)