<xsl:stylesheet 
  xmlns:math="http://www.w3.org/1998/Math/MathML"
  xmlns:om="http://www.openmath.org/OpenMath"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  version="2.0"
>
  <!-- 
    the naming of symbols is like LaTeX, 
    NOTE: there is no omicron, and not all capitals are present
  -->
  <xsl:variable name='greek_letters' as='xs:string*' 
    select='("alpha", "beta", "gamma", "delta", "epsilon", 
      "varepsilon", "zeta", "eta", "theta", "vartheta", 
      "iota", "kappa", "lambda", "mu", "nu", 
      "xi", "pi", "varpi", "rho", "varrho", 
      "sigma", "varsigma", "tau", "upsilon", "phi", 
      "varphi", "chi", "psi", "omega", "Gamma", 
      "Delta", "Theta", "Lambda", "Xi", "Pi", 
      "Sigma", "Upsilon", "Phi", "Psi", "Omega")'
  />
  <!--
    unicode description                     latex 
    U+03B1  greek small letter alpha        alpha    
    U+03B2  greek small letter beta         beta
    U+03B3  greek small letter gamma        gamma
    U+03B4  greek small letter delta        delta    
    U+03F5  greek lunate epsilon symbol     epsilon

    U+03B5  greek small letter epsilon      varepsilon  
    U+03B6  greek small letter zeta         zeta   
    U+03B7  greek small letter eta          eta
    U+03B8  greek small letter theta        theta  
    U+03D1  greek theta symbol              vartheta 

    U+03B9  greek small letter iota         iota
    U+03BA  greek small letter kappa        kappa
    U+03BB  greek small letter lambda       lambda 
    U+03BC  greek small letter mu           mu
    U+03BD  greek small letter nu           nu

    U+03BE  greek small letter xi           xi
    U+03BF  greek small letter omicron      -
    U+03C0  greek small letter pi           pi
    U+03D6  greek pi symbol                 varpi
    U+03C1  greek small letter rho          rho 
    U+03F1  greek rho symbol                varrho   

    U+03C3  greek small letter sigma        sigma
    U+03C2  greek small letter final sigma  varsigma 
    U+03C4  greek small letter tau          tau    
    U+03C5  greek small letter upsilon      upsilon  
    U+03D5  greek phi symbol                phi

    U+03C6  greek small letter phi          varphi   
    U+03C7  greek small letter chi          chi    
    U+03C8  greek small letter psi          psi      
    U+03C9  greek small letter omega        omega
    U+0391  greek capital letter alpha      -
    U+0392  greek capital letter beta       -
    U+0393  greek capital letter gamma      Gamma

    U+0394  greek capital letter delta      Delta
    U+0395  greek capital letter epsilon    -
    U+0396  greek capital letter zeta       -
    U+0397  greek capital letter eta        -
    U+0398  greek capital letter theta      Theta
    U+0399  greek capital letter iota       -
    U+039A  greek capital letter kappa      -
    U+039B  greek capital letter lambda     Lambda
    U+039C  greek capital letter mu         -
    U+039D  greek capital letter nu         -
    U+039E  greek capital letter xi         Xi
    U+039F  greek capital letter omicron    -
    U+03A0  greek capital letter pi         Pi

    U+03A1  greek capital letter rho        -
    U+03A3  greek capital letter sigma      Sigma
    U+03A4  greek capital letter tau        -
    U+03A5  greek capital letter upsilon    -
    U+03D2  greek upsilon with hook sumbol  Upsilon
    U+03A6  greek capital letter phi        Phi
    U+03A7  greek capital letter xi         -
    U+03A8  greek capital letter psi        Psi
    U+03A9  greek capital letter omega      Omega
  -->
  <xsl:variable name='greek_symbols' as='xs:string*' 
    select='("&#x03B1;", "&#x03B2;", "&#x03B3;", "&#x03B4;", "&#x03F5;",
    "&#x03B5;", "&#x03B6;", "&#x03B7;", "&#x03B8;", "&#x03D1;",
    "&#x03B9;", "&#x03BA;", "&#x03BB;", "&#x03BC;", "&#x03BD;",
    "&#x03BE;", "&#x03C0;", "&#x03D6;", "&#x03C1;", "&#x03F1;",
    "&#x03C3;", "&#x03C2;", "&#x03C4;", "&#x03C5;", "&#x03D5;",
    "&#x03C6;", "&#x03C7;", "&#x03C8;", "&#x03C9;", "&#x0393;",
    "&#x0394;", "&#x0398;", "&#x039B;", "&#x039E;", "&#x03A0;",
    "&#x03A3;", "&#x03D2;", "&#x03A6;", "&#x03A8;", "&#x03A9;")'
  />

  <xsl:template match='OMV[boolean(index-of($greek_letters, @name))]|
    om:OMV[boolean(index-of($greek_letters, @name))]'
  >
    <xsl:variable name='name' select='@name'/>
    <math:mrow>
      <math:mi>
        <xsl:value-of 
          select='$greek_symbols[index-of($greek_letters, $name)]'
        />
      </math:mi>
    </math:mrow>
  </xsl:template>
</xsl:stylesheet>

