summaryrefslogtreecommitdiffstats
path: root/xslt/DiveLog.xslt
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2015-02-18 19:55:30 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-18 11:10:38 -0800
commitb87eb781920cd85534d295f75a3b61d382c088a5 (patch)
tree4ed0795e58360e2d5b4bb9e8c051a712e2821422 /xslt/DiveLog.xslt
parentf7365015ff250052ca7d26f4c655b774f3773960 (diff)
downloadsubsurface-b87eb781920cd85534d295f75a3b61d382c088a5.tar.gz
Add serial number to DiveLog import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'xslt/DiveLog.xslt')
-rw-r--r--xslt/DiveLog.xslt23
1 files changed, 19 insertions, 4 deletions
diff --git a/xslt/DiveLog.xslt b/xslt/DiveLog.xslt
index 9855ae34e..818b50d49 100644
--- a/xslt/DiveLog.xslt
+++ b/xslt/DiveLog.xslt
@@ -2,17 +2,31 @@
<xsl:strip-space elements="*"/>
<xsl:output method="xml" indent="yes"/>
+ <xsl:key name="DC" match="dive" use="concat(@ComputerID, ':', @Computer)"/>
+
<xsl:template match="/">
<divelog program='subsurface-import' version='2'>
<settings>
- <divecomputerid deviceid="ffffffff">
+ <!-- Using the serial number as device ID for now. Once we have
+ a change to get some testing done, we can jump on using
+ extension that provides sha1 function.
+
++ xmlns:crypto="http://exslt.org/crypto"
++ extension-element-prefixes="crypto"
++ <divecomputerid deviceid="{substring(crypto:sha1(concat(@ComputerID, ':', @Computer)), 1, 8)}">
+
+-->
+
+ <xsl:for-each select="logbook/dive[generate-id() = generate-id(key('DC',concat(@ComputerID, ':', @Computer))[1])]">
+ <divecomputerid deviceid="{@ComputerID}">
<xsl:attribute name="model">
- <xsl:value-of select="logbook/@program"/>
+ <xsl:value-of select="@Computer"/>
</xsl:attribute>
<xsl:attribute name="serial">
- <xsl:value-of select="logbook/@serialNumber"/>
+ <xsl:value-of select="@ComputerID"/>
</xsl:attribute>
</divecomputerid>
+ </xsl:for-each>
</settings>
<dives>
<xsl:apply-templates select="/logbook"/>
@@ -136,7 +150,8 @@
<xsl:value-of select="@DiveMaster"/>
</divemaster>
- <divecomputer deviceid="ffffffff">
+ <divecomputer deviceid="{@ComputerID}">
+
<xsl:attribute name="model">
<xsl:value-of select="@Computer"/>
</xsl:attribute>