[PATCH] Correct ending pressure for .DLD export

Miika Turkia miika.turkia at gmail.com
Thu Mar 14 11:19:53 PDT 2013


Forget about this. I just re-read Dirk's earlier mail and noticed that
the logic is reversed to what he wants. (Grab the info from first
cylinder only if samples do not have pressure data.) Will re-send
shortly.

miika

On Thu, Mar 14, 2013 at 8:16 PM, Miika Turkia <miika.turkia at gmail.com> wrote:
> Logic here is to use the pressure values from the first cylinder, if it
> has both start and end pressures. Otherwise we just grab the pressures
> from first and last samples having such information.
>
> Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
> ---
> If multiple computers have pressure sensors and pressure data is not
> available on cylinders, this will grab the start pressure from the first
> pressure sample (first computer having a sensor) and end pressure from
> the last pressure sample. So most likely these pressures are from
> different cylinders.
> ---
>  xslt/divelogs-export.xslt |   24 +++++++++++++++++++-----
>  1 file changed, 19 insertions(+), 5 deletions(-)
>
> diff --git a/xslt/divelogs-export.xslt b/xslt/divelogs-export.xslt
> index 9a69546..1a3e45d 100644
> --- a/xslt/divelogs-export.xslt
> +++ b/xslt/divelogs-export.xslt
> @@ -45,13 +45,27 @@
>        <xsl:value-of select="substring-before(cylinder/@size, ' ')"/>
>      </CYLINDERSIZE>
>      <CYLINDERSTARTPRESSURE>
> -      <xsl:value-of select="substring-before(node()/sample/@pressure, ' ')"/>
> +      <xsl:choose>
> +        <xsl:when test="cylinder[1]/@start and cylinder[1]/@end">
> +          <xsl:value-of select="cylinder[1]/@start"/>
> +        </xsl:when>
> +        <xsl:otherwise>
> +          <xsl:value-of select="substring-before(node()/sample/@pressure, ' ')"/>
> +        </xsl:otherwise>
> +      </xsl:choose>
>      </CYLINDERSTARTPRESSURE>
>      <CYLINDERENDPRESSURE>
> -      <xsl:variable name="samples">
> -        <xsl:value-of select="count(node()/sample)"/>
> -      </xsl:variable>
> -      <xsl:value-of select="node()/sample[position() = $samples]/@pressure"/>
> +      <xsl:choose>
> +        <xsl:when test="cylinder[1]/@start and cylinder[1]/@end">
> +          <xsl:value-of select="cylinder[1]/@end"/>
> +        </xsl:when>
> +        <xsl:otherwise>
> +          <xsl:variable name="samples">
> +            <xsl:value-of select="count(node()/sample[@pressure!=''])"/>
> +          </xsl:variable>
> +          <xsl:value-of select="node()/sample[position() = $samples]/@pressure"/>
> +        </xsl:otherwise>
> +      </xsl:choose>
>      </CYLINDERENDPRESSURE>
>      <WEIGHT>
>        <xsl:call-template name="sum">
> --
> 1.7.9.5
>


More information about the subsurface mailing list