diff options
Diffstat (limited to 'xslt/MacDive.xslt')
-rw-r--r-- | xslt/MacDive.xslt | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/xslt/MacDive.xslt b/xslt/MacDive.xslt index 444876721..59b05c3fe 100644 --- a/xslt/MacDive.xslt +++ b/xslt/MacDive.xslt @@ -1,5 +1,6 @@ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:strip-space elements="*"/> + <xsl:include href="commonTemplates.xsl"/> <xsl:output method="xml" indent="yes"/> <xsl:template match="/"> @@ -67,7 +68,16 @@ </xsl:attribute> <xsl:attribute name="tags"> - <xsl:value-of select="entryType"/> + <xsl:for-each select="tags/tag|entryType"> + <xsl:choose> + <xsl:when test="position() = 1"> + <xsl:value-of select="."/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat(',', .)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> </xsl:attribute> <xsl:variable name="delta"> @@ -79,10 +89,10 @@ <location debug="true"> <xsl:for-each select="site/country|site/location|site/name"> <xsl:choose> - <xsl:when test="following-sibling::location[1] != ''"> + <xsl:when test="following-sibling::location[1] != '' and . != ''"> <xsl:value-of select="concat(., ' / ')"/> </xsl:when> - <xsl:when test="following-sibling::name[1] != ''"> + <xsl:when test="following-sibling::name[1] != '' and . != ''"> <xsl:value-of select="concat(., ' / ')"/> </xsl:when> <xsl:otherwise> @@ -104,10 +114,10 @@ <location> <xsl:for-each select="country|location|site"> <xsl:choose> - <xsl:when test="following-sibling::location[1] != ''"> + <xsl:when test="following-sibling::location[1] != '' and . != ''"> <xsl:value-of select="concat(., ' / ')"/> </xsl:when> - <xsl:when test="following-sibling::site[1] != ''"> + <xsl:when test="following-sibling::site[1] != '' and . != ''"> <xsl:value-of select="concat(., ' / ')"/> </xsl:when> <xsl:otherwise> @@ -198,6 +208,21 @@ </cylinder> </xsl:for-each> + <xsl:for-each select="gases/gas"> + <event name="gaschange"> + <xsl:attribute name="time"> + <xsl:call-template name="sec2time"> + <xsl:with-param name="timeSec"> + <xsl:value-of select="sum(preceding-sibling::gas/duration)"/> + </xsl:with-param> + </xsl:call-template> + </xsl:attribute> + <xsl:attribute name="value"> + <xsl:value-of select="helium * 65536 + oxygen"/> + </xsl:attribute> + </event> + </xsl:for-each> + <xsl:if test="diveMaster"> <divemaster> <xsl:value-of select="diveMaster"/> @@ -387,7 +412,7 @@ </xsl:if> </sample> - <xsl:if test="alarm != ''"> + <xsl:if test="alarm != '' and alarm != gas_change"> <event> <xsl:attribute name="time"> <xsl:call-template name="timeConvert"> @@ -543,18 +568,6 @@ </xsl:template> <!-- end convert weight --> - <xsl:template name="temperatureSamples"> - <xsl:param name="units"/> - <xsl:choose> - <xsl:when test="$units = 'Imperial'"> - <xsl:value-of select="count(descendant::temperature[. != 32])"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="count(descendant::temperature[. != 0])"/> - </xsl:otherwise> - </xsl:choose> - </xsl:template> - <xsl:template name="pressureSamples"> <xsl:value-of select="count(descendant::pressure[. > 0])"/> </xsl:template> |