Created
April 10, 2018 15:30
-
-
Save ukanga/18d0457b9e26316fa8e64218075ea607 to your computer and use it in GitHub Desktop.
XForm XML calculate with 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>Paths in a calculate within a repeat are relative.</h:title> | |
| <model> | |
| <instance> | |
| <data id="calculate_w_relative_paths"> | |
| <rep jr:template=""> | |
| <crop/> | |
| <a/> | |
| <group> | |
| <b/> | |
| </group> | |
| </rep> | |
| <meta> | |
| <instanceID/> | |
| </meta> | |
| </data> | |
| </instance> | |
| <bind nodeset="/data/rep/crop" type="select1"/> | |
| <bind calculate="name = current()/../crop " nodeset="/data/rep/a" type="string"/> | |
| <bind calculate="name = current()/../../crop " nodeset="/data/rep/group/b" type="string"/> | |
| <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> | |
| <input ref="/data/rep/a"> | |
| <label>Verify</label> | |
| </input> | |
| <group ref="/data/rep/group"> | |
| <input ref="/data/rep/group/b"> | |
| <label>Verify</label> | |
| </input> | |
| </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