UNPKG

medic-enketo-xslt

Version:

XSL stylesheets for the Enketo XForm transformation to be run client-side in a web browser

130 lines (129 loc) 5.7 kB
<?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:orx="http://openrosa.org/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <h:head> <model> <instance> <data id="NFAM" version="2015-10-01"> <clinic> <name/> <contact>NEW</contact> <location/> <location_calc/> <location_note_message/> <location_hint_calc/> <location_hint_note/> </clinic> <contact> <first_name/> <last_name/> <phone/> <alternate_phone/> <date_of_birth/> <national_id_number/> <notes/> <parent>PARENT</parent> </contact> <repeat-relevant> <child/> </repeat-relevant> <repeat> <child jr:template=""> <type>person</type> <first_name/> <last_name/> <parent>PARENT</parent> </child> </repeat> <meta> <instanceID/> </meta> </data> </instance> <bind nodeset="/data/clinic/name" type="string" calculate='concat(/data/contact/first_name, " ", /data/contact/last_name, "&apos;s family")'/> <bind nodeset="/data/contact/first_name" required="true()" type="string"/> <bind nodeset="/data/contact/last_name" required="true()" type="string"/> <bind nodeset="/data/contact/phone" required="true()" type="tel" jr:constraintMsg="Phone number must be valid and unique."/> <bind nodeset="/data/contact/alternate_phone" type="tel" jr:constraintMsg="Phone number must be valid and unique."/> <bind nodeset="/data/contact/date_of_birth" type="date"/> <bind nodeset="/data/contact/national_id_number" type="string"/> <bind nodeset="/data/contact/notes" type="text"/> <bind nodeset="/data/contact/parent" type="db:clinic"/> <bind nodeset="/data/clinic/location" type="geopoint"/> <bind calculate="concat('Your location for this family is ', if(string-length( /data/clinic/location ) &gt; 0, /data/clinic/location , 'not yet set.'))" nodeset="/data/clinic/location_calc" type="string"/> <bind nodeset="/data/clinic/location_note_message" readonly="true()" type="string"/> <bind calculate="if(string-length( /data/clinic/location_gps ) &gt; 0,'If you wish to reset the location, press the trash icon above and press the &quot;crosshair&quot; button', 'Please make sure that your GPS is ON and that you press the &quot;crosshair&quot; button above before submitting your form')" nodeset="/data/clinic/location_hint_calc" type="string"/> <bind nodeset="/data/clinic/location_hint_note" readonly="true()" type="string"/> <bind calculate="concat('uuid:', uuid())" nodeset="/data/meta/instanceID" readonly="true()" type="string"/> <bind nodeset="/data/repeat-relevant/child" type="select1" required="true()"/> <bind nodeset="/data/repeat" relevant="selected(/data/repeat-relevant/child, 'true')"/> <bind nodeset="/data/repeat/child/first_name" type="string" required="true()"/> <bind nodeset="/data/repeat/child/last_name" type="string" calculate="/data/contact/last_name"/> <bind nodeset="/data/repeat/child/last_name" type="db:clinic"/> </model> </h:head> <h:body class="pages"> <group appearance="field-list" ref="/data/contact"> <label>Head of Family</label> <input ref="/data/contact/first_name"> <label>First Name</label> </input> <input ref="/data/contact/last_name"> <label>Surname</label> </input> <select appearance="horizontal" ref="/data/repeat-relevant/child"> <label>Any children?</label> <item> <label>Yes</label> <value>true</value> </item> <item> <label>No</label> <value>false</value> </item> </select> <group ref="/data/repeat"> <repeat nodeset="/data/repeat/child"> <group ref="/data/repeat/child"> <label>Child</label> <input ref="/data/repeat/child/first_name"> <label>First name</label> </input> </group> </repeat> </group> </group> <group appearance="field-list" ref="/data/contact"> <label>Phone Numbers</label> <input ref="/data/contact/phone"> <label>Primary Number</label> </input> <input ref="/data/contact/alternate_phone"> <label>Secondary Number</label> </input> </group> <group appearance="field-list" ref="/data/contact"> <label>Personal Information</label> <input ref="/data/contact/date_of_birth"> <label>Date of Birth</label> </input> <input ref="/data/contact/national_id_number"> <label>National ID</label> </input> <input ref="/data/contact/notes" appearance="multiline"> <label>Notes</label> </input> </group> <group appearance="field-list" ref="/data/clinic"> <label>Location</label> <input appearance="hide-input" ref="/data/clinic/location"> <label>Press the button to set location</label> </input> <input ref="/data/clinic/location_note_message"> <label>**<output value=" /data/clinic/location_calc "/>**</label> </input> <input ref="/data/clinic/location_hint_note"> <label>_<output value=" /data/clinic/location_hint_calc "/>_</label> </input> </group> </h:body> </h:html>