Convert Coordinates from Decimal Degrees to Degre Minutes Seconds


From: http://spxslt.codeplex.com/Thread/View.aspx?ThreadId=227247
Hi Marc,Got this to work today...I am using the GoogleMaps API and using Decimal Degrees as my 'version of truth' of projects coordinates on my site.Using query string parameters, I have a nice 'Project Page' for 200 project sites - along with profile pictures, dynamic GoogleMaps and relative docs (soon to be accordeon-y).I am for now passing the Lat & Long parameters via the query string as well but may upgrade to getting them via SPServices...Anywho... Some of the users want to see the coordinates being displayed as part of the 'project profile in Degrees Minutes Seconds meaninginstead of 31.29824they want 31° 17' 53.66''(the conversion can be verified on the FCC website at http://www.fcc.gov/mb/audio/bickel/DDDMMSS-decimal.html)
I obviously want to keep the Lat and Long as 2 single fields, in decimal so I can easily sort, pass via QS, etc...
Let me know if a quick snapshot is advised or if the variable names could be improved.Thanks,Greg
<xsl:call-template name="ConvertLatLongfromDec">     <xsl:with-param name="paramLatLong" select="@Latitude"/>    </xsl:call-template> <xsl:template name="ConvertLatLongfromDec">  <xsl:param name="paramLatLong"/>  <xsl:variable name="IntegerDegree" select="floor($paramLatLong)"/>  <xsl:variable name="RestDegree" select="($paramLatLong - $IntegerDegree)*60"/>  <xsl:variable name="IntegerMinutes" select="floor($RestDegree)"/>  <xsl:variable name="RestMinutes" select="($RestDegree - $IntegerMinutes)*60"/>  <xsl:variable name="Seconds" select="(round($RestMinutes*100)) div 100"/>
<!--intermediary calculations results <br/><xsl:value-of select="$paramLatLong"/><br/> <xsl:value-of select="$IntegerDegree"/><br/> <xsl:value-of select="$RestDegree"/><br/> <xsl:value-of select="$IntegerMinutes"/><br/> <xsl:value-of select="$RestMinutes"/><br/> <xsl:value-of select="$Seconds"/> -->  
<xsl:value-of select="concat($IntegerDegree,'° ', $IntegerMinutes,$dvt_apos,' ',$Seconds,$dvt_apos,$dvt_apos)"/> </xsl:template>