mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 18:33:23 +00:00
Import: move some "functions" to commonTemplates
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
parent
1e45637575
commit
3cf9989d65
2 changed files with 60 additions and 60 deletions
|
@ -458,66 +458,6 @@
|
|||
</dive>
|
||||
</xsl:template>
|
||||
|
||||
<!-- convert pressure to bars -->
|
||||
<xsl:template name="pressureConvert">
|
||||
<xsl:param name="number"/>
|
||||
<xsl:param name="units"/>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$units = 'Imperial'">
|
||||
<xsl:value-of select="concat(format-number(($number div 14.5037738007), '#.##'), ' bar')"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat($number, ' bar')"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!-- end convert pressure -->
|
||||
|
||||
<!-- convert cuft to litres -->
|
||||
<xsl:template name="sizeConvert">
|
||||
<xsl:param name="singleSize"/>
|
||||
<xsl:param name="double"/>
|
||||
<xsl:param name="pressure"/>
|
||||
<xsl:param name="units"/>
|
||||
|
||||
<xsl:variable name="size">
|
||||
<xsl:value-of select="format-number($singleSize + $singleSize * $double, '#.##')"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$units = 'Imperial'">
|
||||
<xsl:if test="$pressure != '0'">
|
||||
<xsl:value-of select="concat(format-number((($size * 14.7 div $pressure) div 0.035315), '#.##'), ' l')"/>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat($size, ' l')"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!-- end convert pressure -->
|
||||
|
||||
<!-- convert temperature from F to C -->
|
||||
<xsl:template name="tempConvert">
|
||||
<xsl:param name="temp"/>
|
||||
<xsl:param name="units"/>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$units = 'Imperial'">
|
||||
<xsl:if test="$temp != ''">
|
||||
<xsl:value-of select="concat(format-number(($temp - 32) * 5 div 9, '0.0'), ' C')"/>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:if test="$temp != ''">
|
||||
<xsl:value-of select="concat($temp, ' C')"/>
|
||||
</xsl:if>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!-- end convert temperature -->
|
||||
|
||||
<!-- convert time in seconds to minutes:seconds -->
|
||||
<xsl:template name="timeConvert">
|
||||
<xsl:param name="timeSec"/>
|
||||
|
|
|
@ -184,6 +184,66 @@
|
|||
</xsl:template>
|
||||
<!-- end convert depth -->
|
||||
|
||||
<!-- convert pressure to bars -->
|
||||
<xsl:template name="pressureConvert">
|
||||
<xsl:param name="number"/>
|
||||
<xsl:param name="units"/>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$units = 'Imperial'">
|
||||
<xsl:value-of select="concat(format-number(($number div 14.5037738007), '#.##'), ' bar')"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat($number, ' bar')"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!-- end convert pressure -->
|
||||
|
||||
<!-- convert cuft to litres -->
|
||||
<xsl:template name="sizeConvert">
|
||||
<xsl:param name="singleSize"/>
|
||||
<xsl:param name="double"/>
|
||||
<xsl:param name="pressure"/>
|
||||
<xsl:param name="units"/>
|
||||
|
||||
<xsl:variable name="size">
|
||||
<xsl:value-of select="format-number($singleSize + $singleSize * $double, '#.##')"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$units = 'Imperial'">
|
||||
<xsl:if test="$pressure != '0'">
|
||||
<xsl:value-of select="concat(format-number((($size * 14.7 div $pressure) div 0.035315), '#.##'), ' l')"/>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat($size, ' l')"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!-- end convert pressure -->
|
||||
|
||||
<!-- convert temperature from F to C -->
|
||||
<xsl:template name="tempConvert">
|
||||
<xsl:param name="temp"/>
|
||||
<xsl:param name="units"/>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$units = 'Imperial'">
|
||||
<xsl:if test="$temp != ''">
|
||||
<xsl:value-of select="concat(format-number(($temp - 32) * 5 div 9, '0.0'), ' C')"/>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:if test="$temp != ''">
|
||||
<xsl:value-of select="concat($temp, ' C')"/>
|
||||
</xsl:if>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<!-- end convert temperature -->
|
||||
|
||||
|
||||
<!-- Convert date format "Sun Jan 19 11:02:56 2014 UTC" => 2014-1-19
|
||||
11:02 -->
|
||||
|
|
Loading…
Add table
Reference in a new issue