summaryrefslogtreecommitdiffstats
path: root/xslt
diff options
context:
space:
mode:
Diffstat (limited to 'xslt')
-rw-r--r--xslt/uddf-export.xslt41
-rw-r--r--xslt/uddf.xslt25
2 files changed, 59 insertions, 7 deletions
diff --git a/xslt/uddf-export.xslt b/xslt/uddf-export.xslt
index 53e1e84a7..bf4735f38 100644
--- a/xslt/uddf-export.xslt
+++ b/xslt/uddf-export.xslt
@@ -3,6 +3,7 @@
<xsl:include href="commonTemplates.xsl"/>
<xsl:strip-space elements="*"/>
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
+ <xsl:param name="units" select="units"/>
<xsl:key name="gases" match="cylinder" use="concat(substring-before(@o2, '.'), '/', substring-before(@he, '.'))" />
<xsl:key name="images" match="picture" use="concat(../../dive/@number|../dive/@number, ':', @filename, '@', @offset)" />
@@ -179,12 +180,33 @@
<profiledata>
<xsl:for-each select="trip">
- <repetitiongroup id="{generate-id(.)}">
+ <repetitiongroup>
+ <xsl:attribute name="id">
+ <xsl:choose>
+ <xsl:when test="$test != ''">
+ <xsl:value-of select="generate-id(.)" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'testid1'" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
<xsl:apply-templates select="dive"/>
</repetitiongroup>
</xsl:for-each>
<xsl:for-each select="dive">
- <repetitiongroup id="{generate-id(.)}">
+ <repetitiongroup>
+ <xsl:attribute name="id">
+ <xsl:choose>
+ <xsl:when test="string-length($units) = 0 or $units = 0">
+ <xsl:value-of select="generate-id(.)" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'testid2'" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
<xsl:apply-templates select="."/>
</repetitiongroup>
</xsl:for-each>
@@ -246,7 +268,18 @@
</xsl:template>
<xsl:template match="dive">
- <dive id="{generate-id(.)}" xmlns="http://www.streit.cc/uddf/3.2/">
+ <dive xmlns="http://www.streit.cc/uddf/3.2/">
+ <xsl:attribute name="id">
+ <xsl:choose>
+ <xsl:when test="string-length($units) = 0 or $units = 0">
+ <xsl:value-of select="generate-id(.)" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'testid3'" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
<informationbeforedive>
<xsl:variable name="buddylist">
@@ -505,7 +538,7 @@
</xsl:for-each>
<depth>
- <xsl:value-of select="substring-before(./@depth, ' ')"/>
+ <xsl:value-of select="round(substring-before(./@depth, ' ') * 100) div 100"/>
</depth>
<divetime>
diff --git a/xslt/uddf.xslt b/xslt/uddf.xslt
index 81435b301..e5c0f33f1 100644
--- a/xslt/uddf.xslt
+++ b/xslt/uddf.xslt
@@ -11,7 +11,16 @@
<xsl:template match="/">
<divelog program="subsurface-import" version="2">
<settings>
- <divecomputerid deviceid="ffffffff">
+ <divecomputerid>
+ <xsl:attribute name="deviceid">
+ <xsl:value-of select="/uddf/diver/owner/equipment/divecomputer/@id|/u:uddf/u:diver/u:owner/u:equipment/u:divecomputer/@id|/u1:uddf/u1:diver/u1:owner/u1:equipment/u1:divecomputer/@id" />
+ </xsl:attribute>
+ <xsl:attribute name="model">
+ <xsl:value-of select="/uddf/diver/owner/equipment/divecomputer/model|/u:uddf/u:diver/u:owner/u:equipment/u:divecomputer/u:model|/u1:uddf/u1:diver/u1:owner/u1:equipment/u1:divecomputer/u1:model" />
+ </xsl:attribute>
+ <xsl:attribute name="nickname">
+ <xsl:value-of select="/uddf/diver/owner/equipment/divecomputer/name|/u:uddf/u:diver/u:owner/u:equipment/u:divecomputer/u:name|/u1:uddf/u1:diver/u1:owner/u1:equipment/u1:divecomputer/u1:name" />
+ </xsl:attribute>
<xsl:choose>
<xsl:when test="/UDDF/history != ''">
<xsl:apply-templates select="/UDDF/history"/>
@@ -335,9 +344,19 @@
</xsl:for-each>
- <divecomputer deviceid="ffffffff">
+ <divecomputer>
+ <xsl:attribute name="deviceid">
+ <xsl:value-of select="/uddf/diver/owner/equipment/divecomputer/@id|/u:uddf/u:diver/u:owner/u:equipment/u:divecomputer/@id|/u1:uddf/u1:diver/u1:owner/u1:equipment/u1:divecomputer/@id" />
+ </xsl:attribute>
<xsl:attribute name="model">
- <xsl:value-of select="/uddf/generator/name|/u:uddf/u:generator/u:name|/u1:uddf/u1:generator/u1:name|/UDDF/history/modified/application/name"/>
+ <xsl:choose>
+ <xsl:when test="/uddf/diver/owner/equipment/divecomputer/model|/u:uddf/u:diver/u:owner/u:equipment/u:divecomputer/u:model|/u1:uddf/u1:diver/u1:owner/u1:equipment/u1:divecomputer/u1:model != ''">
+ <xsl:value-of select="/uddf/diver/owner/equipment/divecomputer/model|/u:uddf/u:diver/u:owner/u:equipment/u:divecomputer/u:model|/u1:uddf/u1:diver/u1:owner/u1:equipment/u1:divecomputer/u1:model" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="/uddf/generator/name|/u:uddf/u:generator/u:name|/u1:uddf/u1:generator/u1:name|/UDDF/history/modified/application/name"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:attribute>
<depth>