[PATCH 2/8] Add depth conversions to XSLT

Miika Turkia miika.turkia at gmail.com
Fri Dec 27 23:05:32 UTC 2013


Convert depth to and from mm.

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 xslt/commonTemplates.xsl | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/xslt/commonTemplates.xsl b/xslt/commonTemplates.xsl
index 5c3da40..a238d11 100644
--- a/xslt/commonTemplates.xsl
+++ b/xslt/commonTemplates.xsl
@@ -153,4 +153,16 @@
     </xsl:choose>
   </xsl:template>
 
+  <xsl:template name="depth2mm">
+    <xsl:param name="depth"/>
+
+    <xsl:value-of select="format-number(substring-before($depth, ' '), '#.##') * 1000"/>
+  </xsl:template>
+
+  <xsl:template name="mm2depth">
+    <xsl:param name="depth"/>
+
+    <xsl:value-of select="concat(floor($depth div 1000), '.', format-number($depth mod 1000, '00'))"/>
+  </xsl:template>
+
 </xsl:stylesheet>
-- 
1.8.3.2



More information about the subsurface mailing list