17. Timezone calculations (2)

Calculate the times in the ui document, using XForms bind elements to specify the calculation.

Use bind to define how the various values are calculated (here: hours part, minutes part, sign, and number of seconds since the epoch):

1<xf:bind nodeset="instance('ui')/tz/@h"
         type="xsd:integer"
         calculate="substring(.., 2, 2)"/>
<xf:bind nodeset="instance('ui')/tz/@m"
5	 type="xsd:integer"
         calculate="substring(.., 5, 2)"/>
<xf:bind nodeset="instance('ui')/tz/@sign"
         calculate="substring(.., 1, 1)"/>
<xf:bind nodeset="instance('ui')/tz/@secs"
10         calculate="if(../@sign = '-',
                    0 - (((../@h * 60) + ../@m) * 60),
                    0 + (((../@h * 60) + ../@m) * 60))"/>

Etc., etc., etc. All calculations use xf:bind/@calculate.

Details in the paper.