att.formula
att.formula provides attributes for defining a mathematical formula. [2.3.9 The Unit Declaration] | |||||||
Module | tei — The TEI Infrastructure | ||||||
Members | conversion | ||||||
Attributes |
|
||||||
Example |
<encodingDesc>
<unitDecl> <unitDef xml:id="stadium" type="linear"> <label>stadium</label> <placeName ref="#rome"/> <conversion fromUnit="#pes" toUnit="#stadium" formula="$fromUnit * 625"/> <desc>The stadium was a Roman unit of linear measurement equivalent to 625 pedes, or Roman feet.</desc> </unitDef> </unitDecl> </encodingDesc> |
||||||
Example |
<encodingDesc>
<unitDecl> <unitDef xml:id="wmw" type="power"> <label>whatmeworry</label> <conversion fromUnit="#hpk" toUnit="#wmw" formula="$fromUnit * 1"/> <desc>In the Potrzebie system of measures as introduced by Donald Knuth, the whatmeworry unit of power is equivalent to one hah per kovac.</desc> </unitDef> <unitDef xml:id="kwmw" type="power"> <label>kilowhatmeworry</label> <conversion fromUnit="#wmw" toUnit="#kwmw" formula="$fromUnit div 1000"/> <desc>The kilowhatmeworry is equivalent to 1000 whatmeworries.</desc> </unitDef> <unitDef xml:id="ap" type="power"> <label>kilowhatmeworry</label> <conversion fromUnit="#kwmw" toUnit="#ap" formula="$fromUnit div 100"/> <desc>One unit of aeolipower (A.P.) is equivalent to 100 kilowhatmeworries.</desc> </unitDef> </unitDecl> </encodingDesc> |
||||||
Example |
<conversion fromUnit="#furlongsPerFortnight"
toUnit="#milesPerHour" formula="$fromUnit cast as xs:decimal * 0.000372"/> |
||||||
Example |
<conversion fromUnit="#deciday"
toUnit="hour" formula="$fromUnit cast as xs:decimal * 144 div 60"/> |
||||||
Note |
This attribute class provides formula for use in defining a value used in mathematical calculation. It can be used to store a mathematical operation needed to convert from one system of measurement to another. We use the teidata.xpath datatype to express this value in order to communicate mathematical operations on an XML node or nodes. The $fromUnit variable notation simplifies referencing of the fromUnit attribute on the parent conversion element. Note that ‘div’ is required to express the division operator in XPath. |