aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2017-05-05 19:17:57 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-05-06 08:06:42 -0700
commit5f3f64197771ff66976ee3acd3ba62373c0ffe47 (patch)
tree7d28dcf50ede69327ba78e94de3a3c26e2774a97
parent95365292ef4d6cf3902924de819cad7cf0f5f50d (diff)
downloadsubsurface-5f3f64197771ff66976ee3acd3ba62373c0ffe47.tar.gz
Add test mode support for UDDF export XSLT
The current code that calls the export transformation supports parameter units, so using it here to enable test mode.
-rw-r--r--xslt/uddf-export.xslt39
1 files changed, 36 insertions, 3 deletions
diff --git a/xslt/uddf-export.xslt b/xslt/uddf-export.xslt
index ed0ffe16b..87868070a 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">
+ <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">
+ <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">