<?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>setvalue</h:title>
        <model>
            <instance>
                <data id="setvalue">
                    <a/>
                    <b/>
                    <c/>
                    <my_age/>
                    <my_age_changed/>
                    <person>
                        <age/>
                        <age_changed/>
                    </person>
                    <meta>
                        <instanceID/>
                    </meta>
                </data>
            </instance>
            <bind nodeset="/data/a" type="int"/>
            <bind nodeset="/data/c" type="string"/>
            <bind nodeset="/data/my_age_changed" type="int"/>
            <bind nodeset="/data/person/age" type="decimal"/>

            <setvalue event="odk-instance-first-load">ab</setvalue>
        </model>
    </h:head>
    <h:body>
        <setvalue event="odk-instance-first-load" ref="/data/b" value="str-length(/data/c)"/>
        <input ref="/data/c">
            <label>Enter</label>
        </input>
        <select1 ref="/data/my_age" appearance="minimal">
            <label>Your age</label>
            <setvalue event="xforms-value-changed" ref="/data/my_age_changed" value="(3+3"/>
            <item>
                <label>10</label>
                <value>10</value>
            </item>
            <item>
                <label>11</label>
                <value>11</value>
            </item>
        </select1>
        <repeat nodeset="/data/person">
            <setvalue event="odk-new-repeat odk-instance-first-load" ref="/data/person/age" value="if(position(..) = 1, '', 3.14))" />
            <input ref="/data/person/age">
                <label>Person's age</label>
                <setvalue event="xforms-value-changed" ref="/data/person/age_chang">Age changed!</setvalue>
            </input>
        </repeat>
    </h:body>
</h:html>
