]> Wikimedia Canada | Git repositories - eccc_to_commons.git/commitdiff
Fix almanach merger with empty normalMean temperatures
authorPierre Choffet <peuc@wanadoo.fr>
Tue, 25 May 2021 05:28:07 +0000 (01:28 -0400)
committerPierre Choffet <peuc@wanadoo.fr>
Tue, 25 May 2021 05:28:07 +0000 (01:28 -0400)
eccc_merger_almanach.xslt

index 010a97f6e87e4c22b941ee10e0b9fbaa84377f66..a215480011e43f6e10053531b5ff584f51bf4752 100644 (file)
                                        <xsl:value-of select="format-number(number($input-normal-mean/text() * $input-normal-mean/@values-count + $merge-normal-mean/text()) div number($input-normal-mean/@values-count + 1), '0.0')" />
                                </xsl:copy>
                        </xsl:when>
-                       <xsl:when test="$input-normal-mean and (not($merge-normal-mean) or $merge-normal-mean/text() = '')">
+                       <xsl:when test="$input-normal-mean != '' and (not($merge-normal-mean) or $merge-normal-mean = '')">
                                <xsl:copy>
                                        <xsl:apply-templates select="$input-normal-mean/@*" />
                                        <xsl:apply-templates select="$input-normal-mean/node()" />
                                </xsl:copy>
                        </xsl:when>
-                       <xsl:when test="not($input-normal-mean) and $merge-normal-mean and $merge-normal-mean/text() != ''">
+                       <xsl:when test="(not($input-normal-mean) or $input-normal-mean = '') and $merge-normal-mean and $merge-normal-mean != ''">
                                <xsl:copy>
                                        <xsl:apply-templates select="$merge-normal-mean/@*" />
                                        <xsl:attribute name="values-count">1</xsl:attribute>
                                        <xsl:apply-templates select="$merge-normal-mean/node()" />
                                </xsl:copy>
                        </xsl:when>
+                       <xsl:when test="$input-normal-mean = '' and $merge-normal-mean = ''">
+                               <xsl:copy>
+                                       <xsl:apply-templates select="$input-normal-mean/@*" />
+                                       <xsl:apply-templates select="$input-normal-mean/node()" />
+                               </xsl:copy>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:message terminate="no">
+                                       <xsl:value-of select="concat($month, '-', $day, ' - normalMean: ', $input-normal-mean, ' ', $merge-normal-mean)" />
+                               </xsl:message>
+                               <xsl:message terminate="yes">Trapping case not supposed to happend.</xsl:message>
+                       </xsl:otherwise>
                </xsl:choose>
        </xsl:template>