Name

ConvertToCelsius

Original Contributor

Matt Bramer

Example

<xsl:call-template name="ConvertToCelsius">
  <xsl:with-param name="paramTemp" select="@TempFarenheit" />
  <xsl:with-param name="AddNotation" select="'True'" />
</xsl:call-template>

Code

<xsl:template name="ConvertToCelsius">
  <xsl:param name="paramTemp" />
  <xsl:param name="AddNotation" />
  <xsl:variable name="DegreesCelsius" select="format-number((($paramTemp - 32) div 9) * 5, &quot;#,##0.0;-#,##0.0&quot;)" />
  <xsl:choose> 
    <xsl:when test="$AddNotation = 'True'"> 
      <xsl:value-of select="concat($DegreesCelsius, '&#176;C')" />
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$DegreesCelsius" />
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

Last edited Feb 18, 2011 at 4:12 AM by sympmarc, version 4

Comments

No comments yet.