diff options
Diffstat (limited to 'xslt/DiveLog.xslt')
-rw-r--r-- | xslt/DiveLog.xslt | 23 |
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> |