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

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