Created
April 10, 2018 15:25
-
-
Save ukanga/64fa7684bcdbc740a0346c13264b8285 to your computer and use it in GitHub Desktop.
XForm with choice filter using relative paths
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0"?> | |
| <h:html xmlns="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | |
| <h:head> | |
| <h:title>Choice filter uses relative path</h:title> | |
| <model> | |
| <itext> | |
| <translation default="true()" lang="default"> | |
| <text id="static_instance-crop_list-2"> | |
| <value>Kale</value> | |
| </text> | |
| <text id="static_instance-crop_list-0"> | |
| <value>Maize</value> | |
| </text> | |
| <text id="static_instance-crop_list-1"> | |
| <value>Beans</value> | |
| </text> | |
| </translation> | |
| </itext> | |
| <instance> | |
| <data id="choice_filter_w_relative_paths"> | |
| <rep jr:template=""> | |
| <crop/> | |
| <a/> | |
| <group> | |
| <b/> | |
| </group> | |
| </rep> | |
| <meta> | |
| <instanceID/> | |
| </meta> | |
| </data> | |
| </instance> | |
| <instance id="crop_list"> | |
| <root> | |
| <item> | |
| <itextId>static_instance-crop_list-0</itextId> | |
| <name>maize</name> | |
| </item> | |
| <item> | |
| <itextId>static_instance-crop_list-1</itextId> | |
| <name>beans</name> | |
| </item> | |
| <item> | |
| <itextId>static_instance-crop_list-2</itextId> | |
| <name>kale</name> | |
| </item> | |
| </root> | |
| </instance> | |
| <bind nodeset="/data/rep/crop" type="select1"/> | |
| <bind nodeset="/data/rep/a" type="select1"/> | |
| <bind nodeset="/data/rep/group/b" type="select1"/> | |
| <bind calculate="concat('uuid:', uuid())" nodeset="/data/meta/instanceID" readonly="true()" type="string"/> | |
| </model> | |
| </h:head> | |
| <h:body> | |
| <group ref="/data/rep"> | |
| <label></label> | |
| <repeat nodeset="/data/rep"> | |
| <select1 ref="/data/rep/crop"> | |
| <label>Select</label> | |
| <item> | |
| <label>Maize</label> | |
| <value>maize</value> | |
| </item> | |
| <item> | |
| <label>Beans</label> | |
| <value>beans</value> | |
| </item> | |
| <item> | |
| <label>Kale</label> | |
| <value>kale</value> | |
| </item> | |
| </select1> | |
| <select1 ref="/data/rep/a"> | |
| <label>Verify</label> | |
| <itemset nodeset="instance('crop_list')/root/item[name = current()/../crop ]"> | |
| <value ref="name"/> | |
| <label ref="jr:itext(itextId)"/> | |
| </itemset> | |
| </select1> | |
| <group ref="/data/rep/group"> | |
| <select1 ref="/data/rep/group/b"> | |
| <label>Verify</label> | |
| <itemset nodeset="instance('crop_list')/root/item[name = current()/../../crop ]"> | |
| <value ref="name"/> | |
| <label ref="jr:itext(itextId)"/> | |
| </itemset> | |
| </select1> | |
| </group> | |
| </repeat> | |
| </group> | |
| </h:body> | |
| </h:html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment