Declaration of variables, types and methods.
X-definition
<xd:def xmlns:xd="http://www.xdef.org/xdef/4.2" name="Example" root="Measurements" > <xd:declaration> int num = 0; /* Number of measurements. */ float sum = 0.0; /* Sum of temperatures used for calculation of average. */ /* Type of value of temperature (Celsius degree) .*/ type temperature double(-283.149806372, 10e4); </xd:declaration> <Measurements xd:script="finally printf('Number of measurements: %d, average: %2.1f%n', num, sum/num);" > <Temperature xd:script="occurs +;"> temperature(); onTrue { num++; sum += getParsedFloat(); }; </Temperature> </Measurements> </xd:def>
Input data
<Measurements> <Temperature>-0.5</Temperature> <Temperature>1.65e1</Temperature> <Temperature>25</Temperature> <Temperature>16</Temperature> <Temperature>1.5</Temperature> <Temperature>16.5</Temperature> </Measurements>
You can edit both
X-definition
and/or
Input data