[Dive4elements-commits] [PATCH] Replaced usage of old <dc:for-each filter="..."/> by <dc:filter expr="..."><dc:if test="dc:has-result()">

Wald Commits scm-commit at wald.intevation.org
Mon Apr 1 13:36:20 CEST 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1364816174 -7200
# Node ID 3badc699af0e122f2f09d345d951201d18b408ab
# Parent  35dba807966ae18156e41fce95eb79da97363a8e
Replaced usage of old <dc:for-each filter="..."/>  by <dc:filter expr="..."><dc:if test="dc:has-result()">.

diff -r 35dba807966a -r 3badc699af0e flys-artifacts/doc/conf/meta-data.xml
--- a/flys-artifacts/doc/conf/meta-data.xml	Fri Mar 29 14:25:36 2013 +0100
+++ b/flys-artifacts/doc/conf/meta-data.xml	Mon Apr 01 13:36:14 2013 +0200
@@ -906,52 +906,65 @@
             </dems>
           </dc:macro>
 
+          <dc:macro name="filter_hws_ddg">
+            <dc:macro name="durchlass_damm_graben">
+              <dc:macro name="ddg_factory">
+                <dc:for-each>
+                  <hws factory="hwsfactory" name="{$hws_name}"/>
+                </dc:for-each>
+              </dc:macro>
+
+              <dc:filter expr="$kws_kind=1">
+                <dc:if test="dc:has-result()">
+                  <Durchlass><dc:call-macro name="ddg_factory"/></Durchlass>
+                </dc:if>
+              </dc:filter>
+
+              <dc:filter expr="$kws_kind=2">
+                <dc:if test="dc:has-result()">
+                  <Damm><dc:call-macro name="ddg_factory"/></Damm>
+                </dc:if>
+              </dc:filter>
+
+              <dc:filter expr="$kws_kind=3">
+                <dc:if test="dc:has-result()">
+                  <Graben><dc:call-macro name="ddg_factory"/></Graben>
+                </dc:if>
+              </dc:filter>
+            </dc:macro>
+
+            <dc:filter expr="$hws_official=1">
+              <dc:if test="dc:has-result()">
+                <official>
+                  <dc:call-macro name="durchlass_damm_graben"/>
+                </official>
+              </dc:if>
+            </dc:filter>
+
+            <dc:filter expr="$hws_official=0">
+              <dc:if test="dc:has-result()">
+                <inofficial>
+                  <dc:call-macro name="durchlass_damm_graben"/>
+                </inofficial>
+              </dc:if>
+            </dc:filter>
+          </dc:macro>
+
           <dc:macro name="flood-map-hws-lines">
             <dc:context>
               <dc:statement>
                 SELECT DISTINCT
-                       name AS hws_name,
+                       name     AS hws_name,
                        official AS hws_official,
-                       kind_id AS hws_kind
+                       kind_id  AS hws_kind
                 FROM hws_lines
                 WHERE river_id = ${river_id}
               </dc:statement>
-              <lines>
-                <official>
-                  <Durchlass>
-                    <dc:for-each filter="$hws_kind=1 and $hws_official=1">
-                        <hws factory="hwsfactory" name="{$hws_name}"/>
-                    </dc:for-each>
-                  </Durchlass>
-                  <Damm>
-                    <dc:for-each filter="$hws_kind=2 and $hws_official=1">
-                        <hws factory="hwsfactory" name="{$hws_name}"/>
-                    </dc:for-each>
-                  </Damm>
-                  <Graben>
-                    <dc:for-each filter="$hws_kind=3 and $hws_official=1">
-                      <hws factory="hwsfactory" name="{$hws_name}"/>
-                    </dc:for-each>
-                  </Graben>
-                </official>
-                <inofficial>
-                  <Durchlass>
-                    <dc:for-each filter="$hws_kind=1 and $hws_official=0">
-                      <hws factory="hwsfactory" name="{$hws_name}"/>
-                    </dc:for-each>
-                  </Durchlass>
-                  <Damm>
-                    <dc:for-each filter="$hws_kind=2 and $hws_official=0">
-                      <hws factory="hwsfactory" name="{$hws_name}"/>
-                    </dc:for-each>
-                  </Damm>
-                  <Graben>
-                    <dc:for-each filter="$hws_kind=3 and $hws_official=0">
-                      <hws factory="hwsfactory" name="{$hws_name}"/>
-                    </dc:for-each>
-                  </Graben>
-                </inofficial>
-              </lines>
+              <dc:if test="dc:has-result()">
+                <lines>
+                  <dc:call-macro name="filter_hws_ddg"/>
+                </lines>
+              </dc:if>
             </dc:context>
           </dc:macro>
 
@@ -959,48 +972,17 @@
             <dc:context>
               <dc:statement>
                 SELECT DISTINCT
-                       name AS hws_points_name,
-                       official AS hws_points_official,
-                       kind_id AS hws_points_kind
+                       name     AS hws_name,
+                       official AS hws_official,
+                       kind_id  AS hws_kind
                 FROM hws_points
                 WHERE river_id = ${river_id}
               </dc:statement>
-              <points>
-                <official>
-                  <Durchlass>
-                    <dc:for-each filter="$hws_points_kind=1 and $hws_points_official=1">
-                      <hws factory="hwsfactory" name="{$hws_points_name}"/>
-                    </dc:for-each>
-                  </Durchlass>
-                  <Damm>
-                    <dc:for-each filter="$hws_points_kind=2 and $hws_points_official=1">
-                      <hws factory="hwsfactory" name="{$hws_points_name}"/>
-                    </dc:for-each>
-                  </Damm>
-                  <Graben>
-                    <dc:for-each filter="$hws_kind=3 and $hws_official=1">
-                      <hws factory="hwsfactory" name="{$hws_points_name}"/>
-                    </dc:for-each>
-                  </Graben>
-                </official>
-                <inofficial>
-                  <Durchlass>
-                    <dc:for-each filter="$hws_points_kind=1 and $hws_points_official=0">
-                      <hws factory="hwsfactory" name="{$hws_points_name}"/>
-                    </dc:for-each>
-                  </Durchlass>
-                  <Damm>
-                    <dc:for-each filter="$hws_points_kind=2 and $hws_points_official=0">
-                      <hws factory="hwsfactory" name="{$hws_points_name}"/>
-                    </dc:for-each>
-                  </Damm>
-                  <Graben>
-                    <dc:for-each filter="$hws_points_kind=3 and $hws_points_official=0">
-                      <hws factory="hwsfactory" name="{$hws_points_name}"/>
-                    </dc:for-each>
-                  </Graben>
-                </inofficial>
-              </points>
+              <dc:if test="dc:has-result()">
+                <points>
+                  <dc:call-macro name="filter_hws_ddg"/>
+                </points>
+              </dc:if>
             </dc:context>
           </dc:macro>
 
@@ -1259,27 +1241,38 @@
               Call from a context where fed_name hws_kind hws_name and river_id is
               availble
             </dc:comment>
-            <Durchlass>
-              <dc:for-each filter="$hws_kind=1">
+
+            <dc:macro name="hwslines_by_kind_factory">
+              <dc:for-each>
                 <hws factory="wmshwslinesfactory"
                      ids="{$river_id};{$hws_name}"
                      name="{$hws_name}"/>
               </dc:for-each>
-            </Durchlass>
-            <Damm>
-              <dc:for-each filter="$hws_kind=2">
-                <hws factory="wmshwslinesfactory"
-                     ids="{$river_id};{$hws_name}"
-                     name="{$hws_name}"/>
-              </dc:for-each>
-            </Damm>
-            <Graben>
-              <dc:for-each filter="$hws_kind=3">
-                <hws factory="wmshwslinesfactory"
-                     ids="{$river_id};{$hws_name}"
-                     name="{$hws_name}"/>
-              </dc:for-each>
-            </Graben>
+            </dc:macro>
+
+            <dc:filter expr="$hws_kind=1">
+              <dc:if test="dc:has-result()">
+                <Durchlass>
+                  <dc:call-macro name="hwslines_by_kind_factory"/>
+                </Durchlass>
+              </dc:if>
+            </dc:filter>
+
+            <dc:filter expr="$hws_kind=2">
+              <dc:if test="dc:has-result()">
+                <Damm>
+                  <dc:call-macro name="hwslines_by_kind_factory"/>
+                </Damm>
+              </dc:if>
+            </dc:filter>
+
+            <dc:filter expr="$hws_kind=3">
+              <dc:if test="dc:has-result()">
+                <Graben>
+                  <dc:call-macro name="hwslines_by_kind_factory"/>
+                </Graben>
+              </dc:if>
+            </dc:filter>
           </dc:macro>
 
           <dc:macro name="hwslines">
@@ -1379,27 +1372,38 @@
               Call from a context where fed_name hws_kind hws_name and river_id is
               availble
             </dc:comment>
-            <Durchlass>
-              <dc:for-each filter="$hws_kind=1">
+
+            <dc:macro name="hwspoints_by_kind_factory">
+              <dc:for-each>
                 <hws factory="wmshwspointsfactory"
                      ids="{$river_id};{$hws_name}"
                      name="{$hws_name}"/>
               </dc:for-each>
-            </Durchlass>
-            <Damm>
-              <dc:for-each filter="$hws_kind=2">
-                <hws factory="wmshwspointsfactory"
-                     ids="{$river_id};{$hws_name}"
-                     name="{$hws_name}"/>
-              </dc:for-each>
-            </Damm>
-            <Graben>
-              <dc:for-each filter="$hws_kind=3">
-                <hws factory="wmshwspointsfactory"
-                     ids="{$river_id};{$hws_name}"
-                     name="{$hws_name}"/>
-              </dc:for-each>
-            </Graben>
+            </dc:macro>
+
+            <dc:filter expr="$hws_kind=1">
+              <dc:if test="dc:has-result()">
+                <Durchlass>
+                  <dc:call-macro name="hwspoints_by_kind_factory"/>
+                </Durchlass>
+              </dc:if>
+            </dc:filter>
+
+            <dc:filter expr="$hws_kind=2">
+              <dc:if test="dc:has-result()">
+                <Damm>
+                  <dc:call-macro name="hwspoints_by_kind_factory"/>
+                </Damm>
+              </dc:if>
+            </dc:filter>
+
+            <dc:filter expr="$hws_kind=3">
+              <dc:if test="dc:has-result()">
+                <Graben>
+                  <dc:call-macro name="hwspoints_by_kind_factory"/>
+                </Graben>
+              </dc:if>
+            </dc:filter>
           </dc:macro>
 
           <dc:macro name="hwspoints">


More information about the Dive4elements-commits mailing list