<?xml version="1.0" encoding="UTF-8"?>
<!-- © TEI Consortium. Dual-licensed under CC-by and BSD2 licenses; see the file COPYING.txt for details. -->
<?xml-model href="https://jenkins.tei-c.org/job/TEIP5-dev/lastSuccessfulBuild/artifact/P5/release/xml/tei/odd/p5.nvdl" type="application/xml" schematypens="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"?>
<classSpec xmlns="http://www.tei-c.org/ns/1.0" module="tei" type="atts" xml:id="class-attr-formula" ident="att.formula">
  <desc versionDate="2019-06-25" xml:lang="en">provides attributes for defining a mathematical formula.</desc>
  <attList>
    <attDef ident="formula" usage="opt">
      <desc versionDate="2019-06-25" xml:lang="en">A <att>formula</att> is provided to describe a mathematical calculation such as a conversion between measurement systems.</desc>
      <datatype><dataRef key="teidata.xpath"/></datatype>
    </attDef>
  </attList>
      <exemplum xml:lang="en">
        <egXML xmlns="http://www.tei-c.org/ns/Examples" xml:id="class-attr-formula-egXML-ut" source="#SMITHWM">
          <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>
        </egXML>
      </exemplum>
  <exemplum xml:lang="en">
    <egXML xmlns="http://www.tei-c.org/ns/Examples" xml:id="class-attr-formula-egXML-dd" source="#KNUTHMAD">
      <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>
    </egXML>
  </exemplum>
  <exemplum xml:lang="en">
    <egXML xmlns="http://www.tei-c.org/ns/Examples" xml:id="class-attr-formula-egXML-ak" source="#NONE">
      <conversion fromUnit="#furlongsPerFortnight" toUnit="#milesPerHour" formula="$fromUnit cast as xs:decimal * 0.000372"/>
    </egXML>
  </exemplum>
  <exemplum xml:lang="en">
    <egXML xmlns="http://www.tei-c.org/ns/Examples" xml:id="class-attr-formula-egXML-gz" source="#NONE">
      <conversion fromUnit="#deciday" toUnit="hour" formula="$fromUnit cast as xs:decimal * 144 div 60"/>
    </egXML>
  </exemplum>
  <remarks versionDate="2019-06-25" xml:lang="en">
    <p>This attribute class provides <att>formula</att> 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 <att>fromUnit</att> attribute on the parent <gi>conversion</gi> element. Note that <q>div</q> is required to express the division operator in XPath.</p>
  </remarks>
  <listRef>
    <ptr target="#HDUDECL" type="div3"/>
  </listRef>
</classSpec>
