mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add serial number to DiveLog import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f7365015ff
commit
b87eb78192
1 changed files with 19 additions and 4 deletions
|
@ -2,17 +2,31 @@
|
||||||
<xsl:strip-space elements="*"/>
|
<xsl:strip-space elements="*"/>
|
||||||
<xsl:output method="xml" indent="yes"/>
|
<xsl:output method="xml" indent="yes"/>
|
||||||
|
|
||||||
|
<xsl:key name="DC" match="dive" use="concat(@ComputerID, ':', @Computer)"/>
|
||||||
|
|
||||||
<xsl:template match="/">
|
<xsl:template match="/">
|
||||||
<divelog program='subsurface-import' version='2'>
|
<divelog program='subsurface-import' version='2'>
|
||||||
<settings>
|
<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:attribute name="model">
|
||||||
<xsl:value-of select="logbook/@program"/>
|
<xsl:value-of select="@Computer"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:attribute name="serial">
|
<xsl:attribute name="serial">
|
||||||
<xsl:value-of select="logbook/@serialNumber"/>
|
<xsl:value-of select="@ComputerID"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
</divecomputerid>
|
</divecomputerid>
|
||||||
|
</xsl:for-each>
|
||||||
</settings>
|
</settings>
|
||||||
<dives>
|
<dives>
|
||||||
<xsl:apply-templates select="/logbook"/>
|
<xsl:apply-templates select="/logbook"/>
|
||||||
|
@ -136,7 +150,8 @@
|
||||||
<xsl:value-of select="@DiveMaster"/>
|
<xsl:value-of select="@DiveMaster"/>
|
||||||
</divemaster>
|
</divemaster>
|
||||||
|
|
||||||
<divecomputer deviceid="ffffffff">
|
<divecomputer deviceid="{@ComputerID}">
|
||||||
|
|
||||||
<xsl:attribute name="model">
|
<xsl:attribute name="model">
|
||||||
<xsl:value-of select="@Computer"/>
|
<xsl:value-of select="@Computer"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue