I am creating TimeTrackingAddRq XML and getting error? - quickbooks

Error: "QuickBooks found an error when parsing the provided XML text stream."
Not able to find out what the actual error.
Here is XML:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<TimeTrackingAddRq requestID="1">
<TimeTrackingAdd>
<TxnDate>2017-08-23</TxnDate>
<EntityRef>
<FullName>Tarun Enest</FullName>
</EntityRef>
<CustomerRef>
<FullName>Bunn-O-Matic Corporation</FullName>
</CustomerRef>
<ItemServiceRef>
<FullName>LRMT</FullName>
</ItemServiceRef>
<Duration>0.3</Duration>
<PayrollItemWageRef>
<FullName>Hourly Techs</FullName>
</PayrollItemWageRef>
<ClassRef>
<FullName/>
</ClassRef>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
</TimeTrackingAddRq>
<TimeTrackingAddRq requestID="2">
<TimeTrackingAdd>
<TxnDate>2017-04-27</TxnDate>
<EntityRef>
<FullName>Tarun Enest</FullName>
</EntityRef>
<CustomerRef>
<FullName>Bunn-O-Matic Corporation</FullName>
</CustomerRef>
<ItemServiceRef>
<FullName>LRMT</FullName>
</ItemServiceRef>
<Duration>0.0</Duration>
<PayrollItemWageRef>
<FullName>Hourly Techs</FullName>
</PayrollItemWageRef>
<ClassRef>
<FullName/>
</ClassRef>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
</TimeTrackingAddRq>
<TimeTrackingAddRq requestID="3">
<TimeTrackingAdd>
<TxnDate>2017-08-23</TxnDate>
<EntityRef>
<FullName>Tarun Enest</FullName>
</EntityRef>
<CustomerRef>
<FullName>Bunn-O-Matic Corporation</FullName>
</CustomerRef>
<ItemServiceRef>
<FullName>LRMT</FullName>
</ItemServiceRef>
<Duration>0.0</Duration>
<PayrollItemWageRef>
<FullName>Hourly Techs</FullName>
</PayrollItemWageRef>
<ClassRef>
<FullName/>
</ClassRef>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
</TimeTrackingAddRq>
<TimeTrackingAddRq requestID="4">
<TimeTrackingAdd>
<TxnDate>2017-04-27</TxnDate>
<EntityRef>
<FullName>Tarun Enest</FullName>
</EntityRef>
<CustomerRef>
<FullName>Bunn-O-Matic Corporation</FullName>
</CustomerRef>
<ItemServiceRef>
<FullName>LRMT</FullName>
</ItemServiceRef>
<Duration>0.1</Duration>
<PayrollItemWageRef>
<FullName>Hourly Techs</FullName>
</PayrollItemWageRef>
<ClassRef>
<FullName/>
</ClassRef>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
</TimeTrackingAddRq>
<TimeTrackingAddRq requestID="5">
<TimeTrackingAdd>
<TxnDate>2017-04-27</TxnDate>
<EntityRef>
<FullName>Tarun Enest</FullName>
</EntityRef>
<CustomerRef>
<FullName>Bunn-O-Matic Corporation</FullName>
</CustomerRef>
<ItemServiceRef>
<FullName>LRMT</FullName>
</ItemServiceRef>
<Duration>0.0</Duration>
<PayrollItemWageRef>
<FullName>Hourly Techs</FullName>
</PayrollItemWageRef>
<ClassRef>
<FullName/>
</ClassRef>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
</TimeTrackingAddRq>
<TimeTrackingAddRq requestID="6">
<TimeTrackingAdd>
<TxnDate>2017-04-27</TxnDate>
<EntityRef>
<FullName>Tarun Enest</FullName>
</EntityRef>
<CustomerRef>
<FullName>Bunn-O-Matic Corporation</FullName>
</CustomerRef>
<ItemServiceRef>
<FullName>LRMT</FullName>
</ItemServiceRef>
<Duration>0.0</Duration>
<PayrollItemWageRef>
<FullName>Hourly Techs</FullName>
</PayrollItemWageRef>
<ClassRef>
<FullName/>
</ClassRef>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
</TimeTrackingAddRq>
<TimeTrackingAddRq requestID="7">
<TimeTrackingAdd>
<TxnDate>2017-08-22</TxnDate>
<EntityRef>
<FullName>Tarun Enest</FullName>
</EntityRef>
<CustomerRef>
<FullName>Travel</FullName>
</CustomerRef>
<ItemServiceRef>
<FullName>LRMT</FullName>
</ItemServiceRef>
<Duration>0.4</Duration>
<PayrollItemWageRef>
<FullName>Hourly Techs</FullName>
</PayrollItemWageRef>
<ClassRef>
<FullName>Dallas</FullName>
</ClassRef>
<BillableStatus>Billable</BillableStatus>
</TimeTrackingAdd>
</TimeTrackingAddRq>
</QBXMLMsgsRq>`enter code here`
</QBXML>
Please help me to over come the issue.
Can Any one provide me the sample code for this how to create a web service for this.
How to return a response from Quickbook webconnector?

Related

Orbeon Forms: How to populate a control value via an Action

Forgive the simple question, but how can I pass a value into a control via an Action.
What I'm trying to achieve is to display a message popup with two buttons, and depending on the button pressed, I then want to populate a control value:
<xf:action observer="Message1-control" event="DOMActivate">
<xf:label>Alert Button</xf:label>
<xf:message>You pressed the Message 1 button</xf:message>
<!-- Here is where we want to write the value back to a control -->
</xf:action>
I've tried all sorts of synyax, but I'm struggling to get it right
I make demo form for you https://demo.orbeon.com/demo/fr/orbeon/builder/edit/2e978a87be5ce4112d9b008dd481ae935040861c
I use xxf:show and xxf:dialog to show modal popup with two controls. In button in modal I use xf:setvalue to propagate value from input and xxf:hide to hide window.
<xh:html xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:map="http://www.w3.org/2005/xpath-functions/map"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:array="http://www.w3.org/2005/xpath-functions/array"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:saxon="http://saxon.sf.net/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xf="http://www.w3.org/2002/xforms">
<xh:head>
<xh:title>Untitled Form</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true" xxf:analysis.calculate="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<section-1>
<grid-1>
<AgeOutput/>
<BtnShowDialog/>
 <btnDialogBox/>
<textBoxDialog/>
</grid-1>
</section-1>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="grid-1-bind" ref="grid-1" name="grid-1">
<xf:bind id="AgeOutput-bind" name="AgeOutput" ref="AgeOutput" xxf:whitespace="trim"/>
<xf:bind id="BtnShowDialog-bind" ref="BtnShowDialog" name="BtnShowDialog"/>
<xf:bind id="textBoxDialog-bind" name="textBoxDialog" ref="textBoxDialog"
xxf:whitespace="trim"/>
<xf:bind id="btnDialogBox-bind" ref="btnDialogBox" name="btnDialogBox"/>
</xf:bind>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance id="fr-form-metadata" xxf:readonly="true" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>test</application-name>
<form-name>age_dialog</form-name>
<title xml:lang="en">Untitled Form</title>
<description xml:lang="en"/>
<created-with-version>2021.1.6.202211071741 PE</created-with-version>
<library-versions>
<orbeon>14</orbeon>
<app>2</app>
</library-versions>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments/>
</xf:instance>
<!-- All form resources -->
<xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<section-1>
<label>Untitled Section</label>
</section-1>
<AgeOutput>
<label/>
<hint/>
</AgeOutput>
<BtnShowDialog>
<label>Show dialog</label>
<hint/>
</BtnShowDialog>
<textBoxDialog>
<label>Age</label>
<hint/>
</textBoxDialog>
<btnDialogBox>
<label>Send</label>
<hint/>
</btnDialogBox>
</resource>
</resources>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<fr:section id="section-1-section" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid id="grid-1-grid" bind="grid-1-bind">
<fr:c y="1" x="1" w="6">
<xf:input id="AgeOutput-control" bind="AgeOutput-bind">
<xf:label ref="$form-resources/AgeOutput/label"/>
<xf:hint ref="$form-resources/AgeOutput/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</fr:c>
<fr:c y="1" x="7" w="6">
<xf:trigger id="BtnShowDialog-control" bind="BtnShowDialog-bind">
<xf:label ref="$form-resources/BtnShowDialog/label"/>
<xf:hint ref="$form-resources/BtnShowDialog/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xxf:show event="DOMActivate" dialog="my-dialog-id"/>
</xf:trigger>
</fr:c>
</fr:grid>
</fr:section>
<xxf:dialog id="my-dialog-id" appearance="full" level="modal" close="true" draggable="true"
visible="false">
<xf:label>Age confirm</xf:label>
<xf:input id="textBoxDialog-control" bind="textBoxDialog-bind">
<xf:label ref="$form-resources/textBoxDialog/label"/>
<xf:hint ref="$form-resources/textBoxDialog/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
<xf:trigger id="btnDialogBox-control" bind="btnDialogBox-bind">
<xf:label ref="$form-resources/btnDialogBox/label"/>
<xf:hint ref="$form-resources/btnDialogBox/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:action event="DOMActivate">
<!-- Operation to perform -->
<xf:setvalue ref="//AgeOutput" value="//textBoxDialog"/>
</xf:action>
<xxf:hide event="DOMActivate" dialog="my-dialog-id"/>
</xf:trigger>
</xxf:dialog>
</fr:body>
</fr:view>
</xh:body>
</xh:html>

Orbeon preselect autocomplete value in reusable component

I'm using Orbeon v2017.1 and I'm trying to create a service within a Section Template which is supposed to retrieve the label of the default country which should be preselected in an autocomplete field (country).
I want to preselect the country only if the user has not entered a value (or, when the form loads). It should support multiple languages.
If I trigger the action after "form loads" and after "the controls are ready", it calls my service but only for the library form. For all other forms which include this reusable section, the service is not called.
Is there some other way this could be achieved? Thanks in advance.
EDIT
Below is an example of an autocomplete field, service, and action which sets the control value
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude">
<xh:head>
<xh:title/>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<xf:instance id="all-countries"
src="http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso/ListOfCountryNamesByName/XML"/>
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<section-1>
<country-dynamic-autocomplete label=""/>
</section-1>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="country-dynamic-autocomplete-bind" ref="country-dynamic-autocomplete"
name="country-dynamic-autocomplete"/>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>insurance</application-name>
<form-name>test</form-name>
<title xml:lang="en"/>
<description xml:lang="en"/>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources -->
<!-- Don't make readonly by default in case a service modifies the resources -->
<xf:instance id="fr-form-resources" xxf:readonly="false" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<country-dynamic-autocomplete>
<label>Countries Preselect Value</label>
<hint/>
</country-dynamic-autocomplete>
<section-1>
<label>Country Section</label>
</section-1>
</resource>
</resources>
</xf:instance>
<xf:instance id="get-default-country-value-instance" class="fr-service"
xxf:exclude-result-prefixes="#all">
<body xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:fbf="java:org.orbeon.oxf.fb.FormBuilder"><params/></body>
</xf:instance>
<xf:submission id="get-default-country-value-submission" class="fr-service"
resource="http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso/CountryName/XML/debug?sCountryISOCode=DE"
method="get"
serialization="none"
mediatype="none"/>
<xf:action id="set-country-default-value-binding">
<xf:action event="DOMActivate" ev:observer="country-dynamic-autocomplete-control"
if="true()">
<xf:send submission="get-default-country-value-submission"/>
</xf:action>
<xf:action event="xforms-submit" ev:observer="get-default-country-value-submission">
<xf:var name="request-instance-name" value="'get-default-country-value-instance'"/>
<xf:action/>
</xf:action>
<xf:action event="xforms-submit-done" ev:observer="get-default-country-value-submission">
<xf:action class="fr-set-control-value-action">
<xf:var name="control-name" value="'country-dynamic-autocomplete'"/>
<xf:var name="control-value" value="/string"/>
</xf:action>
</xf:action>
</xf:action>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<fr:section id="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<fr:autocomplete xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
id="country-dynamic-autocomplete-control"
labelref="#label"
max-results-displayed="300"
resource="http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso/ListOfCountryNamesByName/XML"
bind="country-dynamic-autocomplete-bind">
<xf:label ref="$form-resources/country-dynamic-autocomplete/label"/>
<xf:hint ref="$form-resources/country-dynamic-autocomplete/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="/ArrayOftCountryCodeAndName/tCountryCodeAndName">
<xf:label ref="sName"/>
<xf:value ref="sISOCode"/>
</xf:itemset>
</fr:autocomplete>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
EDIT 2 (new service):
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude">
<xh:head>
<xh:title/>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<xf:instance id="all-countries" src="http://api.worldbank.org/v2/countries/"/>
<!-- Main instance --> <xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<section-1>
<country-dynamic-autocomplete label=""/>
<control-3/>
</section-1>
</form>
</xf:instance>
<!-- Bindings --> <xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="country-dynamic-autocomplete-bind" ref="country-dynamic-autocomplete"
name="country-dynamic-autocomplete"/>
<xf:bind id="control-3-bind" ref="control-3" name="control-3" xxf:whitespace="trim"/>
</xf:bind>
</xf:bind>
<!-- Metadata --> <xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>insurance</application-name>
<form-name>test</form-name>
<title xml:lang="en"/>
<description xml:lang="en"/>
</metadata>
</xf:instance>
<!-- Attachments --> <xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources --> <!-- Don't make readonly by default in case a service modifies the resources --> <xf:instance id="fr-form-resources" xxf:readonly="false" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<country-dynamic-autocomplete>
<label>Countries Preselect Value</label>
<hint/>
</country-dynamic-autocomplete>
<control-3>
<label>XML</label>
<hint/>
</control-3>
<section-1>
<label>Country Section</label>
</section-1>
</resource>
</resources>
</xf:instance>
<xf:instance id="get-default-country-value-instance" class="fr-service"
xxf:exclude-result-prefixes="#all">
<body xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:fbf="java:org.orbeon.oxf.fb.FormBuilder"><params/></body>
</xf:instance>
<xf:submission id="get-default-country-value-submission" class="fr-service"
resource="http://restcountries.eu/rest/v2/name/deutschland"
method="get"
serialization="none"
mediatype="none"/>
<xf:instance id="json-to-xml-instance" class="fr-service" xxf:exclude-result-prefixes="#all">
<body xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:fbf="java:org.orbeon.oxf.fb.FormBuilder"><params/></body>
</xf:instance>
<xf:submission id="json-to-xml-submission" class="fr-service"
resource="http://restcountries.eu/rest/v2/all"
method="get"
serialization="none"
mediatype="none"/>
<xf:action id="show-json-in-xml-binding">
<xf:action event="fr-run-form-load-action-after-controls" ev:observer="fr-form-model"
if="true()">
<xf:send submission="json-to-xml-submission"/>
</xf:action>
<xf:action event="xforms-submit" ev:observer="json-to-xml-submission">
<xf:var name="request-instance-name" value="'json-to-xml-instance'"/>
<xf:action/>
</xf:action>
<xf:action event="xforms-submit-done" ev:observer="json-to-xml-submission">
<xf:action class="fr-set-control-value-action">
<xf:var name="control-name" value="'control-3'"/>
<xf:var name="control-value" value="saxon:serialize(., 'xml')"/>
</xf:action>
</xf:action>
</xf:action>
<xf:action id="set-country-default-value-binding">
<xf:action event="DOMActivate" ev:observer="country-dynamic-autocomplete-control"
if="true()">
<xf:send submission="get-default-country-value-submission"/>
</xf:action>
<xf:action event="xforms-submit" ev:observer="get-default-country-value-submission">
<xf:var name="request-instance-name" value="'get-default-country-value-instance'"/>
<xf:action/>
</xf:action>
<xf:action event="xforms-submit-done" ev:observer="get-default-country-value-submission">
<xf:action class="fr-set-control-value-action">
<xf:var name="control-name" value="'country-dynamic-autocomplete'"/>
<xf:var name="control-value" value="saxon:serialize(., 'xml')"/>
</xf:action>
</xf:action>
</xf:action>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<fr:section id="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<fr:autocomplete xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
id="country-dynamic-autocomplete-control"
labelref="#label"
max-results-displayed="300"
resource="http://restcountries.eu/rest/v2/all"
bind="country-dynamic-autocomplete-bind">
<xf:label ref="$form-resources/country-dynamic-autocomplete/label"/>
<xf:hint ref="$form-resources/country-dynamic-autocomplete/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="/_/name">
<xf:label ref="name"/>
<xf:value ref="alpha2Code"/>
</xf:itemset>
</fr:autocomplete>
</xh:td>
</xh:tr>
<xh:tr>
<xh:td>
<xf:input id="control-3-control" bind="control-3-bind">
<xf:label ref="$form-resources/control-3/label"/>
<xf:hint ref="$form-resources/control-3/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>

Orbeon dynamic dropdown linked to another field

A variation on the sample dynamic dropdown sample using Form Builder, how does one refer the drop down list to the value of another field. I can get the 'debug' text field to change with ../pet , but the item[#group=context()/../pet] is not working as expected.
Note: The 'petnames' model is included but I could not reference it internally so I reference to an external XML file of the same format.
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:exf="http://www.exforms.org/exf/1-0"
fr:data-format-version="4.0.0">
<xh:head>
<xh:title>Example Dynamic data dropdown</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<section-1>
<pet/>
<control-4/>
<mypetname itemset-empty="true"/>
</section-1>
</form>
</xf:instance>
<xf:instance id="petnames">
<root>
<item group="cat" value="Kitty"/>
<item group="cat" value="Garfield"/>
<item group="dog" value="Spot"/>
<item group="dog" value="Rover"/>
<item group="fish" value="Bubbles"/>
<item group="fish" value="Bob"/>
<item group="cobra" value="King"/>
<item group="cobra" value="Shelby"/>
</root>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="pet-bind" ref="pet" name="pet"/>
<xf:bind id="mypetname-bind" ref="mypetname" name="mypetname"/>
<xf:bind id="control-4-bind" ref="control-4" name="control-4" xxf:whitespace="trim"
calculate="../pet"/>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>samples</application-name>
<form-name>DynamicDataDropdown</form-name>
<title xml:lang="en">Example Dynamic data dropdown</title>
<description xml:lang="en"/>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources -->
<xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<pet>
<label>Pick a pet</label>
<hint/>
<item>
<label>Cat</label>
<value>cat</value>
</item>
<item>
<label>Dog</label>
<value>dog</value>
</item>
<item>
<label>Fish</label>
<value>fish</value>
</item>
<item>
<label>Cobra</label>
<value>cobra</value>
</item>
</pet>
<control-4>
<label>debug</label>
<hint/>
</control-4>
<mypetname>
<label>Your pet names</label>
<hint/>
</mypetname>
<section-1>
<label>Untitled Section</label>
</section-1>
</resource>
</resources>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<fr:section id="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<xf:select1 id="pet-control" bind="pet-bind" appearance="dropdown">
<xf:label ref="$form-resources/pet/label"/>
<xf:hint ref="$form-resources/pet/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="$form-resources/pet/item">
<xf:label ref="label"/>
<xf:value ref="value"/>
</xf:itemset>
</xf:select1>
</xh:td>
<xh:td>
<xf:input id="control-4-control" bind="control-4-bind">
<xf:label ref="$form-resources/control-4/label"/>
<xf:hint ref="$form-resources/control-4/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
<xh:td>
<fr:databound-select1 xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
id="mypetname-control"
resource="http://192.168.0.80/petnames.xml"
bind="mypetname-bind">
<xf:label ref="$form-resources/mypetname/label"/>
<xf:hint ref="$form-resources/mypetname/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="/root/item[#group=context()/../pet]">
<xf:label ref="#value"/>
<xf:value ref="#value"/>
</xf:itemset>
</fr:databound-select1>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
You can use the following:
<xf:itemset ref="/root/item[#group = xxf:instance('fr-form-instance')/section-1/pet]">
In this case, context() won't work because the XPath expression in the ref is evaluated inside the XBL component, and doesn't have access to what's outside of the component. In some cases however, it is useful to break the encapsulation, and for those cases the extension function xxf:instance() allows you to do so.

Path to static image file modified to Orbeon resource protocol (oxf)

I'm using XInclude to import several forms as tabs on a multi-tabbed container form (using fr:tabbable and fr:tab). I am importing the model, binds, resources and body of each sub-form.
One of the components on a tab is an XBL component containing an HTML img element pointing to a static png image file. The image is displayed ok when the sub-form is published and invoked on its own, but when imported on to the multi-tabbed form the image link is broken.
When inspecting the source, the path to the image in the /xbl folder has been modified to include the oxf:/ protocol.
In addition, there is logic on the xbl form control to make it non-relevant when the form is loaded and depends on a checkbox to make it relevant. When the logic is removed, the image is displayed.
I have done some more testing and confirm that the problem occurs when enabling non-relevant controls on a form which has been imported via xinclude.
Orbeon is also in persistence mode using the CRUD REST api to save and publish forms as text files.
Is there anything I can do to make sure the image path is initialised when it is non-relevant?
Many thanks,
Import.xhtml
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder">
<xh:head>
<xh:title>Import Test</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<xi:include href="oxf:/forms/Testing/FootMapTest/form/form.xhtml"
xpointer="xpath(//form/*)"/>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xi:include href="oxf:/forms/Testing/FootMapTest/form/form.xhtml"
xpointer="xpath(//xf:model/xf:bind[#id='fr-form-binds']/*)"/>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>Testing</application-name>
<form-name>ImportTest</form-name>
<title xml:lang="en">Import Test</title>
<description xml:lang="en"/>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources -->
<xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<xi:include href="oxf:/forms/Testing/FootMapTest/form/form.xhtml"
xpointer="xpath(//resources/resource[#xml:lang='en']/*)"/>
</resource>
</resources>
</xf:instance>
<!-- Utility instances for services -->
<xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
<request/>
</xf:instance>
<xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
<response/>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:xbl="http://www.w3.org/ns/xbl">
<fr:tabbable>
<fr:tab>
<fr:label>Tab 1</fr:label>
<xi:include href="oxf:/forms/Testing/FootMapTest/form/form.xhtml"
xpointer="xpath(//xh:body/fr:view/fr:body/*)"/>
</fr:tab>
</fr:tabbable>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
FootMapTest.xhtml
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder">
<xh:head>
<xh:title>FootMap Test</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<section-1>
<showFoot/>
<control-2/>
</section-1>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="control-2-bind" ref="control-2" name="control-2"
relevant="$showFoot=true()"/>
<xf:bind id="showFoot-bind" ref="showFoot" name="showFoot" type="xf:boolean"/>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>Testing</application-name>
<form-name>FootMapTest</form-name>
<title xml:lang="en">FootMap Test</title>
<description xml:lang="en"/>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources -->
<xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<showFoot>
<label>Show Foot?</label>
<hint/>
</showFoot>
<control-2>
<label/>
<hint/>
</control-2>
<section-1>
<label>Untitled Section</label>
</section-1>
</resource>
</resources>
</xf:instance>
<!-- Utility instances for services -->
<xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
<request/>
</xf:instance>
<xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
<response/>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:xbl="http://www.w3.org/ns/xbl">
<fr:section id="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<fr:yesno-input xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
id="showFoot-control"
bind="showFoot-bind">
<xf:label ref="$form-resources/showFoot/label"/>
<xf:hint ref="$form-resources/showFoot/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:yesno-input>
</xh:td>
<xh:td>
<nhs:footmap xmlns:nhs="http://www.wales.nhs.uk/"
xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
side="left"
siteselect=""
missingtoes=""
testorder=""
id="control-2-control"
bind="control-2-bind">
<xf:label ref="$form-resources/control-2/label"/>
<xf:hint ref="$form-resources/control-2/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</nhs:footmap>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
footmap.xbl
<xbl:xbl xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:nhs="http://www.wales.nhs.uk/">
<xbl:script src="/xbl/nhs/footmap/footmap.js"/>
<xbl:binding id="nhs-footmap" element="nhs|footmap"
xxf:external-events="nhs-footmap-updated nhs-footmap-refresh"
xxbl:mode="lhha binding value extenal-value focus"
xxbl:container="span">
<metadata xmlns="http://orbeon.org/oxf/xml/form-builder">
<display-name lang="en">Foot Map</display-name>
<icon lang="en">
<small-icon>/apps/fr/style/images/silk/image.png</small-icon>
<large-icon>/apps/fr/style/images/silk/image.png</large-icon>
</icon>
<templates>
<view>
<nhs:footmap side="left" siteselect="" missingtoes="" testorder="">
<xf:label ref=""/>
<xf:hint ref=""/>
<xf:help ref=""/>
<xf:alert ref=""/>
</nhs:footmap>
</view>
</templates>
<control-details>
<xf:select1 ref="#side">
<xf:label>Side:</xf:label>
<xf:hint>Which foot?</xf:hint>
<xf:item>
<xf:label>Left</xf:label>
<xf:value>left</xf:value>
</xf:item>
<xf:item>
<xf:label>Right</xf:label>
<xf:value>right</xf:value>
</xf:item>
</xf:select1>
<xf:select ref="#siteselect" appearance="full">
<xf:label>Sites:</xf:label>
<xf:hint>Which sites?</xf:hint>
<xf:item selected="true">
<xf:label>Big Toe (1):</xf:label>
<xf:value>1</xf:value>
</xf:item>
<xf:item selected="true">
<xf:label>Middle Toe (3):</xf:label>
<xf:value>3</xf:value>
</xf:item>
<xf:item selected="true">
<xf:label>Little Toe (5):</xf:label>
<xf:value>5</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Plantar</xf:label>
<xf:value>6</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Medial</xf:label>
<xf:value>7</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Lateral</xf:label>
<xf:value>8</xf:value>
</xf:item>
</xf:select>
<xf:select ref="#missingtoes" appearance="full">
<xf:label>Missing Toes:</xf:label>
<xf:hint>Which toes are missing?</xf:hint>
<xf:item selected="false">
<xf:label>Big Toe (1):</xf:label>
<xf:value>1</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Index Toe (2):</xf:label>
<xf:value>2</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Middle Toe (3):</xf:label>
<xf:value>3</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Fourth Toe (4):</xf:label>
<xf:value>4</xf:value>
</xf:item>
<xf:item selected="false">
<xf:label>Little Toe (5):</xf:label>
<xf:value>5</xf:value>
</xf:item>
</xf:select>
<xf:input ref="#testorder">
<xf:label>Test Order (json):</xf:label>
<xf:hint>What order should sites be tested?</xf:hint>
</xf:input>
</control-details>
</metadata>
<xbl:resources>
<xbl:style src="/xbl/nhs/footmap/footmap.css"/>
</xbl:resources>
<xbl:handlers>
<xbl:handler event="nhs-footmap-updated" phase="target">
<!-- <xf:message level="modal">
<xf:output value="event('states')" />
</xf:message> -->
<xf:var name="jsonstates" select="event('states')" />
<xf:setvalue ref="xxf:binding('nhs-footmap')" value="$jsonstates" />
</xbl:handler>
<xbl:handler type="javascript" ev:event="xforms-enabled" phase="target">
ORBEON.xforms.XBL.instanceForControl(this).updateAreas();
</xbl:handler>
<xbl:handler type="javascript" ev:event="xforms-disabled" phase="target">
//ORBEON.xforms.XBL.instanceForControl(this).hide();
</xbl:handler>
<!-- <xbl:handler type="javascript" event="nhs-footmap-refresh" phase="target">
ORBEON.xforms.XBL.instanceForControl(this).updateAreas();
</xbl:handler> -->
<xbl:handler type="javascript" event="xforms-value-changed" phase="target">
ORBEON.xforms.XBL.instanceForControl(this).updateAreas();
</xbl:handler>
</xbl:handlers>
<xbl:template xxbl:transform="oxf:unsafe-xslt">
<xsl:transform version="2.0">
<xsl:import href="oxf:/oxf/xslt/utils/xbl.xsl"/>
<xsl:template match="/*">
<xf:group class="nhs-footmap-container">
<xf:model id="footmap-model">
<xf:instance id="areastates">
<json type="object">
<data/>
</json>
</xf:instance>
<xf:instance id="local">
<model>
<side/>
<areas/>
</model>
</xf:instance>
</xf:model>
<!-- Variable pointing to external single-node binding -->
<xf:var name="binding" value="xxf:binding('nhs-footmap')"/>
<xf:var name="binding-context" value="xxf:binding-context('nhs-footmap')"/>
<xf:var name="local" value="instance('local')"/>
<xf:var name="view" value="exf:readonly($binding) and property('xxf:readonly-appearance') = 'static'"/>
<xsl:copy-of select="xxbl:parameter(., 'side')"/>
<xf:var name="leftFoot" value="$side = 'left'" />
<xf:var name="rightFoot" value="$side = 'right'" />
<xf:setvalue ref="instance('local')/side" value="{{$side}}" />
<xf:var name="requestPath" select="xxf:get-request-path()" />
<xsl:copy-of select="xxbl:parameter(., 'siteselect')"/>
<xf:var name="toe1" value="tokenize($siteselect, '\s+') = '1'" />
<xf:var name="toe3" value="tokenize($siteselect, '\s+') = '3'" />
<xf:var name="toe5" value="tokenize($siteselect, '\s+') = '5'" />
<xf:var name="plantar" value="tokenize($siteselect, '\s+') = '6'" />
<xf:var name="medial" value="tokenize($siteselect, '\s+') = '7'" />
<xf:var name="lateral" value="tokenize($siteselect, '\s+') = '8'" />
<xsl:copy-of select="xxbl:parameter(., 'missingtoes')"/>
<xf:var name="missing-toe1" value="tokenize($missingtoes, '\s+') = '1'" />
<xf:var name="missing-toe2" value="tokenize($missingtoes, '\s+') = '2'" />
<xf:var name="missing-toe3" value="tokenize($missingtoes, '\s+') = '3'" />
<xf:var name="missing-toe4" value="tokenize($missingtoes, '\s+') = '4'" />
<xf:var name="missing-toe5" value="tokenize($missingtoes, '\s+') = '5'" />
<xsl:copy-of select="xxbl:parameter(., 'testorder')"/>
<xf:var name="notestorder" value="string-length($testorder)=0" />
<!--<xf:group id="component-group" ref="$binding[not($view)]">-->
<xf:group id="component-group" ref="$binding">
<xf:input ref="$binding" id="nhs-footmap-states" class="nhs-footmap-states" />
<xh:div class="xbl-nhs-footmap-imagemap-div nhs-footmap-imgsize">
<xh:img class="nhs-footmap-footimage" src="/xbl/nhs/footmap/img/{{$side}}foot.png" usemap="#foot-imagemap-{{$side}}" />
<xf:group ref=".[$toe1 and not($missing-toe1)]">
<xh:a href="#" data-value="N" class="nhs-footmap-{{$side}}-toe1 nhs-footmap-site"> <xh:span class="badge">N</xh:span></xh:a>
</xf:group>
<xf:group ref=".[$missing-toe1]">
<xh:a href="#" data-value="-" class="nhs-footmap-{{$side}}-toe1 nhs-footmap-site toe-missing"> <xh:span class="badge"><xh:i class="icon-minus icon-white"/></xh:span></xh:a>
</xf:group>
<xf:group ref=".[$toe3 and not($missing-toe3)]">
<xh:a href="#" data-value="N" class="nhs-footmap-{{$side}}-toe3 nhs-footmap-site"> <xh:span class="badge">N</xh:span> </xh:a>
</xf:group>
<xf:group ref=".[$missing-toe3]">
<xh:a href="#" data-value="-" class="nhs-footmap-{{$side}}-toe3 nhs-footmap-site toe-missing"> <xh:span class="badge"><xh:i class="icon-minus icon-white"/></xh:span></xh:a>
</xf:group>
<xf:group ref=".[$toe5 and not($missing-toe5)]">
<xh:a href="#" data-value="N" class="nhs-footmap-{{$side}}-toe5 nhs-footmap-site"> <xh:span class="badge">N</xh:span> </xh:a>
</xf:group>
<xf:group ref=".[$missing-toe5]">
<xh:a href="#" data-value="-" class="nhs-footmap-{{$side}}-toe5 nhs-footmap-site toe-missing"> <xh:span class="badge"><xh:i class="icon-minus icon-white"/></xh:span></xh:a>
</xf:group>
<xf:group ref=".[$plantar]">
<xh:a href="#" data-value="N" class="nhs-footmap-{{$side}}-toe6 nhs-footmap-site"> <xh:span class="badge">N</xh:span> </xh:a>
</xf:group>
<xf:group ref=".[$medial]">
<xh:a href="#" data-value="N" class="nhs-footmap-{{$side}}-toe7 nhs-footmap-site"> <xh:span class="badge">N</xh:span> </xh:a>
</xf:group>
<xf:group ref=".[$lateral]">
<xh:a href="#" data-value="N" class="nhs-footmap-{{$side}}-toe8 nhs-footmap-site"> <xh:span class="badge">N</xh:span> </xh:a>
</xf:group>
<xf:group ref=".[not($notestorder)]">
<xh:span class="nhs-footmap-{{$side}}-testorder1 nhs-footmap-testorder badge" />
<xh:span class="nhs-footmap-{{$side}}-testorder3 nhs-footmap-testorder badge" />
<xh:span class="nhs-footmap-{{$side}}-testorder5 nhs-footmap-testorder badge" />
<xh:span class="nhs-footmap-{{$side}}-testorder6 nhs-footmap-testorder badge" />
<xh:span class="nhs-footmap-{{$side}}-testorder7 nhs-footmap-testorder badge" />
<xh:span class="nhs-footmap-{{$side}}-testorder8 nhs-footmap-testorder badge" />
</xf:group>
</xh:div>
<!--<xf:trigger id="resetButton">
<xf:label>Reset</xf:label>
<xf:action type="javascript" event="DOMActivate">
ORBEON.xforms.XBL.instanceForControl(this).reset();
</xf:action>
</xf:trigger>-->
<!--<xf:trigger id="absentButton">
<xf:label>Absent</xf:label>
<xf:action type="javascript" event="DOMActivate">
ORBEON.xforms.XBL.instanceForControl(this).absent();
</xf:action>
</xf:trigger>-->
<!-- Properties -->
</xf:group>
<!-- <xf:group ref="$binding[$view]"/> -->
</xf:group>
</xsl:template>
</xsl:transform>
</xbl:template>
</xbl:binding>
</xbl:xbl>

How can I set the relevant property of an Orbeon element to depends on if a previous element is visited or not?

I am trying to create in a form some elements that are visible if one specific element has been visited or not. Is it possible?
At this moment, I only can achieve this copying the relevant part of the first element to the others one, but, in the case on one element depends on many others elements, the relevant rule is too large. Then I am looking for some way to simply this: is there any kind of function like "isVisible()"?
Something like (i.e. control-2 must be visible only if control-1 is visible):
<xf:bind id="control-2-bind" ref="control-2" name="control-2" relevant="isVisible($control-1)"/>
EDITED:
An example of form, where control-5 must be shown only if control-4 is shown.
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder">
<xh:head>
<xh:title>Untitled Form</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance">
<form>
<section-1>
<control-3/>
<control-4/>
<control-5/>
</section-1>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel" id="fr-form-binds"
ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="control-3-bind" ref="control-3" name="control-3"/>
<xf:bind id="control-4-bind" ref="control-4" name="control-4"
relevant="$control-3='one'"/>
<xf:bind id="control-5-bind" ref="control-5" name="control-5"
relevant="xxforms:visited($control-4)"/>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata">
<metadata>
<application-name>asd</application-name>
<form-name>asd</form-name>
<title xml:lang="en">Untitled Form</title>
<description xml:lang="en"/>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources -->
<!-- Don't make readonly by default in case a service modifies the resources -->
<xf:instance id="fr-form-resources" xxf:readonly="false">
<resources>
<resource xml:lang="en">
<control-3>
<item>
<label>First choice</label>
<value>one</value>
</item>
<item>
<label>Second choice</label>
<value>two</value>
</item>
<item>
<label>Third choice</label>
<value>three</value>
</item>
<label/>
<hint/>
</control-3>
<control-4>
<label>Input</label>
<hint/>
</control-4>
<control-5>
<label>Visited</label>
<hint/>
</control-5>
<section-1>
<label>Untitled Section</label>
</section-1>
</resource>
</resources>
</xf:instance>
<!-- Utility instances for services -->
<xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
<request/>
</xf:instance>
<xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
<response/>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:p="http://www.orbeon.com/oxf/pipeline">
<fr:section id="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<xf:select1 id="control-3-control" appearance="full" bind="control-3-bind">
<xf:label ref="$form-resources/control-3/label"/>
<xf:hint ref="$form-resources/control-3/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="$form-resources/control-3/item">
<xf:label ref="label"/>
<xf:value ref="value"/>
</xf:itemset>
</xf:select1>
</xh:td>
</xh:tr>
<xh:tr>
<xh:td>
<xf:input id="control-4-control" bind="control-4-bind">
<xf:label ref="$form-resources/control-4/label"/>
<xf:hint ref="$form-resources/control-4/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
</xh:tr>
<xh:tr>
<xh:td>
<xf:output id="control-5-control" bind="control-5-bind">
<xf:label ref="$form-resources/control-5/label"/>
<xf:hint ref="$form-resources/control-5/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:output>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
The code is not working. The control-5 is never shown. What is wrong there?
EDITED: An example using the proposed solution "instance('visited')"
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder">
<xh:head>
<xh:title>Untitled Form</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance">
<form>
<section-1>
<control-3/>
<control-4/>
<control-5/>
</section-1>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel" id="fr-form-binds"
ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="control-3-bind" ref="control-3" name="control-3"/>
<xf:bind id="control-4-bind" ref="control-4" name="control-4"
relevant="$control-3='one'"/>
<xf:bind id="control-5-bind" ref="control-5" name="control-5"
relevant="instance('visited') = 'true' and string-length($control-4)>0"/>
</xf:bind>
</xf:bind>
<!-- Keep track of visited status -->
<xf:instance id="visited">
<visited/>
</xf:instance>
<xf:setvalue ev:event="xxforms-visited" observer="control-4-control"
ref="instance('visited')"
value="'true'"/>
<xf:setvalue ev:event="xxforms-unvisited" observer="control-4-control"
ref="instance('visited')"
value="'false'"/>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata">
<metadata>
<application-name>asd</application-name>
<form-name>asd</form-name>
<title xml:lang="en">Untitled Form</title>
<description xml:lang="en"/>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources -->
<!-- Don't make readonly by default in case a service modifies the resources -->
<xf:instance id="fr-form-resources" xxf:readonly="false">
<resources>
<resource xml:lang="en">
<control-3>
<item>
<label>First choice</label>
<value>one</value>
</item>
<item>
<label>Second choice</label>
<value>two</value>
</item>
<item>
<label>Third choice</label>
<value>three</value>
</item>
<label/>
<hint/>
</control-3>
<control-4>
<label>Input</label>
<hint/>
</control-4>
<control-5>
<label>Visited</label>
<hint/>
</control-5>
<section-1>
<label>Untitled Section</label>
</section-1>
</resource>
</resources>
</xf:instance>
<!-- Utility instances for services -->
<xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
<request/>
</xf:instance>
<xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
<response/>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel">
<fr:section id="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<xf:select1 id="control-3-control" appearance="full" bind="control-3-bind">
<xf:label ref="$form-resources/control-3/label"/>
<xf:hint ref="$form-resources/control-3/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="$form-resources/control-3/item">
<xf:label ref="label"/>
<xf:value ref="value"/>
</xf:itemset>
</xf:select1>
</xh:td>
</xh:tr>
<xh:tr>
<xh:td>
<xf:input id="control-4-control" bind="control-4-bind">
<xf:label ref="$form-resources/control-4/label"/>
<xf:hint ref="$form-resources/control-4/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
</xh:tr>
<xh:tr>
<xh:td>
<xf:output id="control-5-control" bind="control-5-bind">
<xf:label ref="$form-resources/control-5/label"/>
<xf:hint ref="$form-resources/control-5/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:output>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
In this example, if you select 'First Choice' then, the Input Field is shown. And if you fill it with any value, 'Visited' label is therefore shown. This is the expected behaviour. But, if you later change the Radio Button to 'Second Choice', the Input Field is hidden but the 'Visited' label is still visible (only will be hidden if the user deletes the value of the input field, but now is hidden). This is undesired. There is any way to avoid this?
NOTE: I have added string-length() to be sure that is hidden if the value has been removed. Without it, always is visible.
Since Orbeon Forms 4 there is:
the xxf:visited() function
the xxforms-visited and xxforms-unvisited events
You have to be careful with dependencies when using the function, especially on xf:bind.
I tried to build a naive example, but it turns out that it doesn't work and I entered an issue.
Here is a workaround, which requires adding a custom XForms instance:
<xf:bind id="control-5-bind" ref="control-5" name="control-5"
relevant="instance('visited') = 'true'"/>
<xf:instance id="visited"><visited/></xf:instance>
<xf:setvalue event="xxforms-visited" observer="control-4-control" ref="instance('visited')" value="'true'"/>
<xf:setvalue event="xxforms-unvisited" observer="control-4-control" ref="instance('visited')" value="'false'"/>
And here is the complete example.

Resources