changeset 5976:178a873df7a9

Add OUT parameter to each ids parameter The Datacage should now be constructed in the form that a choice is done based on the current out. All outs are iterated and the recommendations / non recommendations added accordingly. There is another iteration in the old calculations part. Important: Please do not add any elements with a factory outside of an iterate loop!
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 10 May 2013 15:23:14 +0200
parents 95b9e40bbad0
children 0ddb8be91f2f
files artifacts/doc/conf/meta-data.xml
diffstat 1 files changed, 481 insertions(+), 390 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/doc/conf/meta-data.xml	Fri May 10 15:16:36 2013 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Fri May 10 15:23:14 2013 +0200
@@ -80,7 +80,7 @@
                       <dc:call-macro name="SQL-wst_columns_statement"/>
                       <dc:for-each>
                         <column name="{$prot_column_name}"
-                                ids="base_data-wstv-{$prot_rel_pos}-{$prot_id}"
+                                ids="base_data-wstv-{$prot_rel_pos}-{$prot_id}:OUT={$OUT}"
                                 factory="staticwqkms"
                                 info="{$info} [km {$deffrom} - {$defto}]"/>
                       </dc:for-each>
@@ -108,7 +108,7 @@
                       <dc:call-macro name="SQL-wst_columns_statement"/>
                       <dc:for-each>
                         <column name="{$prot_column_name}"
-                                ids="base_data-wstv-{$prot_rel_pos}-{$prot_id}"
+                                ids="base_data-wstv-{$prot_rel_pos}-{$prot_id}:OUT={$OUT}"
                                 factory="wqinterpol"
                                 info="{$info} [km {$deffrom} - {$defto}]"/>
                       </dc:for-each>
@@ -136,7 +136,7 @@
                       <dc:call-macro name="SQL-wst_columns_statement"/>
                       <dc:for-each>
                         <column name="{$prot_column_name}"
-                                ids="additionalsmarks-wstv-{$prot_rel_pos}-{$prot_id}"
+                                ids="additionalsmarks-wstv-{$prot_rel_pos}-{$prot_id}:OUT={$OUT}"
                                 factory="staticwkms"
                                 info="{$info} [km {$deffrom} - {$defto}]"/>
                       </dc:for-each>
@@ -163,7 +163,7 @@
                       <dc:call-macro name="SQL-wst_columns_statement"/>
                       <dc:for-each>
                         <column name="{$prot_column_name}"
-                                ids="additionals-wstv-{$prot_rel_pos}-{$prot_id}"
+                                ids="additionals-wstv-{$prot_rel_pos}-{$prot_id}:OUT={$OUT}"
                                 factory="staticwkms"
                                 info="{$info} [km {$deffrom} - {$defto}]"/>
                       </dc:for-each>
@@ -191,7 +191,7 @@
                       <dc:call-macro name="SQL-wst_columns_statement"/>
                       <dc:for-each>
                         <column name="{$prot_column_name}"
-                                ids="additionals-wstv-{$prot_rel_pos}-{$prot_id}"
+                                ids="additionals-wstv-{$prot_rel_pos}-{$prot_id}:OUT={$OUT}"
                                 factory="staticwkms"
                                 info="{$info} [km {$deffrom} - {$defto}]"/>
                       </dc:for-each>
@@ -219,7 +219,7 @@
                       <dc:call-macro name="SQL-wst_columns_statement"/>
                       <dc:for-each>
                         <column name="{$prot_column_name}"
-                                ids="fixations-wstv-{$prot_rel_pos}-{$prot_id}"
+                                ids="fixations-wstv-{$prot_rel_pos}-{$prot_id}:OUT={$OUT}"
                                 factory="wqinterpol"
                                 info="{$info} [km {$deffrom} - {$defto}]"/>
                       </dc:for-each>
@@ -247,7 +247,7 @@
                       <dc:call-macro name="SQL-wst_columns_statement"/>
                       <dc:for-each>
                         <column name="{$prot_column_name}"
-                                ids="fixations-wstv-{$prot_rel_pos}-{$prot_id}"
+                                ids="fixations-wstv-{$prot_rel_pos}-{$prot_id}:OUT={$OUT}"
                                 factory="staticwqkms"
                                 info="{$info} [km {$deffrom} - {$defto}]"/>
                       </dc:for-each>
@@ -275,7 +275,7 @@
                       <dc:call-macro name="SQL-wst_columns_statement"/>
                       <dc:for-each>
                         <column name="{$prot_column_name}"
-                                ids="fixations-wstv-{$prot_rel_pos}-{$prot_id}"
+                                ids="fixations-wstv-{$prot_rel_pos}-{$prot_id}:OUT={$OUT}"
                                 factory="staticwkms"
                                 info="{$info} [km {$deffrom} - {$defto}]"/>
                       </dc:for-each>
@@ -303,7 +303,7 @@
                       <dc:call-macro name="SQL-wst_columns_statement"/>
                       <dc:for-each>
                         <column name="{$prot_column_name}"
-                                ids="additionals-wstv-{$prot_rel_pos}-{$prot_id}"
+                                ids="additionals-wstv-{$prot_rel_pos}-{$prot_id}:OUT={$OUT}"
                                 factory="staticwqkms"
                                 info="{$info} [km {$deffrom} - {$defto}]"/>
                       </dc:for-each>
@@ -330,7 +330,7 @@
                       <dc:call-macro name="SQL-wst_columns_statement"/>
                       <dc:for-each>
                         <column name="{$prot_column_name}"
-                                ids="heightmarks_points-wstv-{$prot_rel_pos}-{$prot_id}"
+                                ids="heightmarks_points-wstv-{$prot_rel_pos}-{$prot_id}:OUT={$OUT}"
                                 factory="staticwkms"
                                 info="{$info} [km {$deffrom} - {$defto}]"/>
                       </dc:for-each>
@@ -357,7 +357,7 @@
                       <dc:call-macro name="SQL-wst_columns_statement"/>
                       <dc:for-each>
                         <column name="{$prot_column_name}"
-                                ids="heightmarks_points-wstv-{$prot_rel_pos}-{$prot_id}"
+                                ids="heightmarks_points-wstv-{$prot_rel_pos}-{$prot_id}:OUT={$OUT}"
                                 factory="staticwkms"
                                 info="{$info} [km {$deffrom} - {$defto}]"/>
                       </dc:for-each>
@@ -384,7 +384,7 @@
                       <dc:call-macro name="SQL-wst_columns_statement"/>
                       <dc:for-each>
                         <column name="{$prot_column_name}"
-                                ids="heightmarks_annotations-wstv-{$prot_rel_pos}-{$prot_id}"
+                                ids="heightmarks_annotations-wstv-{$prot_rel_pos}-{$prot_id}:OUT={$OUT}"
                                 factory="wqinterpol"
                                 info="{$info} [km {$deffrom} - {$defto}]"/>
                       </dc:for-each>
@@ -414,7 +414,7 @@
                         <dc:call-macro name="SQL-wst_columns_statement"/>
                         <dc:for-each>
                           <column name="{$prot_column_name}"
-                                  ids="flood_protection-wstv-{$prot_rel_pos}-{$prot_id}"
+                                  ids="flood_protection-wstv-{$prot_rel_pos}-{$prot_id}:OUT={$OUT}"
                                   factory="staticwkms"
                                   info="{$info} [km {$deffrom} - {$defto}]"/>
                         </dc:for-each>
@@ -443,7 +443,7 @@
                       <dc:call-macro name="SQL-wst_columns_statement"/>
                       <dc:for-each>
                         <column name="{$prot_column_name}"
-                                ids="flood_protection-wstv-{$prot_rel_pos}-{$prot_id}"
+                                ids="flood_protection-wstv-{$prot_rel_pos}-{$prot_id}:OUT={$OUT}"
                                 factory="staticwkms"
                                 info="{$info} [km {$deffrom} - {$defto}]"/>
                       </dc:for-each>
@@ -456,23 +456,23 @@
         </dc:macro>
 
         <dc:macro name="mainvalues">
-          <mainvalue factory="mainvalue" ids="{$river_id}"/>
-          <wmainvalue factory="mainvalue" ids="{$river_id}:w"/>
-          <qmainvalue factory="mainvalue" ids="{$river_id}:q"/>
+          <mainvalue factory="mainvalue" ids="{$river_id}:OUT={$OUT}"/>
+          <wmainvalue factory="mainvalue" ids="{$river_id}:w:OUT={$OUT}"/>
+          <qmainvalue factory="mainvalue" ids="{$river_id}:q:OUT={$OUT}"/>
         </dc:macro>
 
         <dc:macro name="qsectors">
-          <qsector factory="qsectors" ids="{$river_id}"/>
+          <qsector factory="qsectors" ids="{$river_id}:OUT={$OUT}"/>
         </dc:macro>
 
         <dc:macro name="annotations">
-          <annotation factory="annotations" ids="{$river_id}"/>
+          <annotation factory="annotations" ids="{$river_id}:OUT={$OUT}"/>
         </dc:macro>
 
         <dc:macro name="annotations_per_type">
           <annotations>
             <dc:context>
-              <all_annotations factory="annotations" ids="{$river_id}"/>
+              <all_annotations factory="annotations" ids="{$river_id}:OUT={$OUT}"/>
               <dc:statement>
                 SELECT id          AS anno_id,
                        name AS anno_description
@@ -481,7 +481,7 @@
               <dc:for-each>
                 <annotation name="{$anno_description}"
                             factory="annotations"
-                            ids="{$river_id}:{$anno_description}"/>
+                            ids="{$river_id}:{$anno_description}:OUT={$OUT}"/>
              </dc:for-each>
             </dc:context>
           </annotations>
@@ -502,7 +502,7 @@
                 </dc:statement>
                 <dc:for-each>
                   <cross_section name="{$prot_description}"
-                                 ids="{$prot_id}"
+                                 ids="{$prot_id}:OUT={$OUT}"
                                  factory="crosssections"/>
                 </dc:for-each>
               </dc:context>
@@ -524,7 +524,9 @@
                     AND he.km BETWEEN ${fromkm} AND ${tokm}
                 </dc:statement>
                 <dc:for-each>
-                  <hyk name="{$hyk_description}" ids="{$hyk_id}" factory="hyk"/>
+                  <hyk name="{$hyk_description}" 
+                    ids="{$hyk_id}:OUT={$OUT}"
+                    factory="hyk"/>
                 </dc:for-each>
               </dc:context></hyks>
           </dc:call-macro>
@@ -541,7 +543,7 @@
                 </dc:statement>
                 <dc:for-each>
                   <flow_velocity_measurement name="{$fvmd}"
-                                             ids="{$fvmid}"
+                                             ids="{$fvmid}:OUT={$OUT}"
                                              factory="flowvelocity">
                     <dc:context>
                       <dc:statement>
@@ -552,7 +554,7 @@
                       </dc:statement>
                       <dc:for-each>
                         <measurement_value name="{$description} - {$station} - {$datetime}"
-                                           ids="{$id}"
+                                           ids="{$id}:OUT={$OUT}"
                                            factory="flowvelocity"/>
                       </dc:for-each>
                     </dc:context>
@@ -574,7 +576,7 @@
               </dc:statement>
               <dc:for-each>
                 <height factory="bedheight"
-                        ids="bedheight-singlevalues-{$bedh_id}-{$bedh_year}"
+                        ids="bedheight-singlevalues-{$bedh_id}-{$bedh_year}:OUT={$OUT}"
                         description="{$bedh_descr}"/>
               </dc:for-each>
             </dc:context>
@@ -599,7 +601,7 @@
                   </dc:statement>
                   <dc:for-each>
                     <morphologic-width name="{$from} - {$to}"
-                                       ids="{$width_id}"
+                                       ids="{$width_id}:OUT={$OUT}"
                                        factory="morph-width"/>
                   </dc:for-each>
                 </dc:context>
@@ -621,178 +623,44 @@
           <dc:call-macro name="annotations_per_type"/>
         </dc:macro>
 
-        <dc:comment>
-        + River-Node
-        </dc:comment>
-        <dc:attribute name="name" value="${river_name}"/>
-
-        <dc:choose>
-          <dc:when test="dc:contains($parameters, 'recommended')">
-             <dc:comment>
-                Recommendations (client shall load immediately).
-             </dc:comment>
-             <dc:if test="dc:contains($artifact-outs, 'w_differences') or (dc:contains($artifact-outs, 'discharge_longitudinal_section'))">
-               <dc:call-macro name="annotations"/>
-             </dc:if>
-             <dc:if test="dc:contains($artifact-outs, 'historical_discharge_wq')">
-               <dc:call-macro name="mainvalues"/>
-             </dc:if>
-             <dc:if test="dc:contains($artifact-outs, 'cross_section')">
-               <dc:call-macro name="cross_sections"/>
-               <dc:call-macro name="hyks"/>
-             </dc:if>
-             <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
-               <dc:call-macro name="mainvalues"/>
-               <dc:call-macro name="basedata_2_fixations_wqkms"/>
-             </dc:if>
-             <dc:if test="dc:contains($artifact-outs, 'duration_curve')">
-               <dc:call-macro name="mainvalues"/>
-             </dc:if>
-             <dc:if test="dc:contains($artifact-outs, 'reference_curve')">
-               <dc:call-macro name="annotations"/>
-               <dc:call-macro name="mainvalues"/>
-             </dc:if>
-             <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve')">
-               <dc:call-macro name="qsectors"/>
-             </dc:if>
-             <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
-               <dc:call-macro name="annotations"/>
-             </dc:if>
-             <dc:if test="dc:contains($artifact-outs, 'fix_longitudinal_section_curve')">
-               <dc:call-macro name="annotations"/>
-             </dc:if>
-             <dc:if test="dc:contains($artifact-outs, 'bed_difference_epoch')">
-               <dc:call-macro name="annotations"/>
-             </dc:if>
-             <dc:if test="dc:contains($artifact-outs, 'bed_difference_year')">
-               <dc:call-macro name="annotations"/>
-             </dc:if>
-             <dc:if test="dc:contains($artifact-outs, 'bed_difference_height_year')">
-               <dc:call-macro name="annotations"/>
-             </dc:if>
-          </dc:when>
-          <dc:otherwise>
-            <dc:comment>
-               Non - Recommendations.
-            </dc:comment>
-            <dc:if test="dc:contains($artifact-outs, 'cross_section')">
-               <dc:call-macro name="basedata_0"/>
-               <dc:call-macro name="basedata_1_additionals"/>
-               <dc:call-macro name="basedata_2_fixations"/>
-               <dc:call-macro name="basedata_3_officials"/>
-               <dc:call-macro name="basedata_4_heightmarks-points"/>
-               <dc:call-macro name="cross_sections"/>
-               <dc:call-macro name="hyks"/>
-            </dc:if>
-            <!--dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
-               <dc:call-macro name="basedata_0_wq"/>
-               <dc:call-macro name="basedata_4_heightmarks-wq"/>
-            </dc:if-->
-            <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'w_differences')) or (dc:contains($artifact-outs, 'discharge_longitudinal_section'))">
-                <dc:call-macro name="longitudinal-section-prototype"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'duration_curve')">
-                <dc:call-macro name="mainvalues"/>
-                <dc:call-macro name="basedata_2_fixations_relative_point"/>
-                <dc:call-macro name="basedata_4_heightmarks-points-relative_points"/>
-                <dc:call-macro name="basedata_5_flood-protections_relative_points"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'reference_curve')">
-              <dc:call-macro name="annotations"/>
-              <!--dc:call-macro name="basedata_0"/-->
-              <dc:call-macro name="basedata_1_additionals-relative_point"/>
-              <dc:comment comment=" FIXATIONS ---------------------------"/>
-              <dc:call-macro name="basedata_2_fixations_relative_point"/>
-              <dc:comment comment=" HOEHENMARKEN ---------------------------"/>
-              <dc:call-macro name="basedata_4_heightmarks-points-relative_points"/>
-              <dc:call-macro name="basedata_5_flood-protections_relative_points"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve')">
-              <dc:call-macro name="basedata_0_wq"/>
-              <dc:call-macro name="basedata_1_additionals_marks"/>
-              <dc:call-macro name="basedata_2_fixations_wqkms"/>
-              <dc:call-macro name="basedata_3_officials"/>
-              <dc:call-macro name="basedata_4_heightmarks-points"/>
-              <dc:call-macro name="basedata_5_flood-protections_relative_points"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'fix_deltawt_curve')">
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'fix_longitudinal_section_curve')">
-              <dc:call-macro name="annotations"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'map')">
-              <dc:call-macro name="flood-map-complete"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'flow_velocity')">
-              <dc:call-macro name="annotations_per_type"/>
-              <dc:call-macro name="flow_velocity_measurements"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'bed_longitudinal_section')">
-              <dc:call-macro name="annotations_per_type"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'sedimentload_ls')">
-              <dc:call-macro name="annotations_per_type"/>
-              <dc:call-macro name="morph_width"/>
-            </dc:if>
-            <dc:comment>
-              MINFO bedheight middle
-            </dc:comment>
-            <dc:if test="dc:contains($artifact-outs, 'bedheight_middle')">
-              <dc:call-macro name="sounding-width"/>
-              <dc:call-macro name="basedata_0"/>
-              <dc:call-macro name="basedata_1_additionals"/>
-              <dc:call-macro name="basedata_2_fixations"/>
-              <dc:call-macro name="basedata_3_officials"/>
-              <dc:call-macro name="annotations_per_type"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'bed_difference_year') or
-                         dc:contains($artifact-outs, 'bed_difference_epoch')">
-              <dc:call-macro name="basedata_0"/>
-              <dc:call-macro name="basedata_1_additionals"/>
-              <dc:call-macro name="basedata_2_fixations"/>
-              <dc:call-macro name="basedata_3_officials"/>
-              <dc:call-macro name="annotations_per_type"/>
-              <dc:call-macro name="morph_width"/>
-            </dc:if>
-           <dc:comment comment="--- non-recommendations---"/>
-          </dc:otherwise>
-        </dc:choose>
-
-        <dc:if test="dc:contains($artifact-outs, 'waterlevels')">
-
-          <!-- base data -->
-          <dc:call-macro name="basedata_0"/>
-
-          <!-- extra-longitudinal-sections -->
-          <dc:call-macro name="basedata_1_additionals"/>
-
-          <!-- fixations -->
-          <dc:call-macro name="basedata_2_fixations"/>
-
-          <!-- flood water marks-->
-          <dc:call-macro name="basedata_4_heightmarks-points"/>
-
-          <!-- flood protection -->
-          <dc:call-macro name="basedata_5_flood-protections"/>
-
-        </dc:if>
-
-        <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve') and not (dc:contains($parameters, 'recommended'))">
+        <dc:macro name="discharge_table_gauge">
           <discharge_table_nn>
             <discharge_table_gauge>
               <dc:context>
                 <dc:statement>
                   SELECT id   AS gauge_id,
-                         name AS gauge_name
+                  name AS gauge_name
                   FROM gauges WHERE river_id = ${river_id}
                 </dc:statement>
                 <dc:for-each>
                   <gauge name="{$gauge_name}"
-                         db-id="{$gauge_id}"
-                         factory="gaugedischarge"
-                         from="{$g_start}"
-                         to="{$g_stop}"
-                         ids="{$gauge_name}"/>
+                    db-id="{$gauge_id}"
+                    factory="gaugedischarge"
+                    from="{$g_start}"
+                    to="{$g_stop}"
+                    ids="{$gauge_name}:OUT={$OUT}"/>
+                </dc:for-each>
+              </dc:context>
+            </discharge_table_gauge>
+          </discharge_table_nn>
+        </dc:macro>
+
+        <dc:macro name="discharge_computed">
+          <discharge_table_nn>
+            <discharge_table_gauge>
+              <dc:context>
+                <dc:statement>
+                  SELECT id   AS gauge_id,
+                  name AS gauge_name
+                  FROM gauges WHERE river_id = ${river_id}
+                </dc:statement>
+                <dc:for-each>
+                  <gauge name="{$gauge_name}"
+                    db-id="{$gauge_id}"
+                    factory="gaugedischarge"
+                    from="{$g_start}"
+                    to="{$g_stop}"
+                    ids="{$gauge_name}:OUT={$OUT}"/>
                   <dc:comment>
                     <!--
                     <gauge>
@@ -814,7 +682,7 @@
                             <dc:attribute name="factory" value="gaugedischarge"/>
                             <dc:attribute name="from" value="${g_start}"/>
                             <dc:attribute name="to" value="${g_stop}"/>
-                            <dc:attribute name="ids" value="${discharge_id}-${g_start}-${g_stop}"/>
+                            <dc:attribute name="ids" value="${discharge_id}-${g_start}-${g_stop}:OUT=${out}"/>
                           </historical>
                         </dc:for-each>
                       </dc:context>
@@ -825,24 +693,9 @@
               </dc:context>
             </discharge_table_gauge>
           </discharge_table_nn>
-
-          <dc:call-macro name="basedata_2_fixations_wqkms"/>
-
-          <dc:call-macro name="basedata_5_flood-protections"/>
-
-          <!-- former waterlevels -->
-          <dc:call-macro name="basedata_0"/>
+        </dc:macro>
 
-          <dc:call-macro name="basedata_1_additionals"/>
-
-          <!-- former flood-water-marks -->
-          <dc:call-macro name="basedata_4_heightmarks-points"/>
-            <computed_discharge_curve>
-              <dc:call-macro name="mainvalues"/>
-            </computed_discharge_curve>
-        </dc:if>
-
-        <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve') and not (dc:contains($parameters, 'recommended'))">
+        <dc:macro name="discharge_fix_wq">
           <discharge_table_nn>
             <discharge_table_gauge>
               <dc:context>
@@ -857,41 +710,259 @@
                          factory="gaugedischarge"
                          from="{$g_start}"
                          to="{$g_stop}"
-                         ids="{$gauge_name}"/>
+                         ids="{$gauge_name}:OUT={$OUT}"/>
                 </dc:for-each>
               </dc:context>
             </discharge_table_gauge>
           </discharge_table_nn>
-        </dc:if>
+        </dc:macro>
+
+        <dc:choose>
+          <dc:when test="dc:contains($parameters, 'recommended')">
+            <dc:comment>
+              Recommendations (client shall load immediately).
+            </dc:comment>
+            <dc:iterate var="out" container="artifact-outs">
+              <dc:choose>
+                <dc:when test="$out = 'w_differences'">
+                  <dc:call-macro name="annotations"/>
+                </dc:when>
+                <dc:when test="$out = 'discharge_longitudinal_section'">
+                  <dc:call-macro name="annotations"/>
+                </dc:when>
+                <dc:when test="$out = 'historical_discharge_wq'">
+                  <dc:call-macro name="mainvalues"/>
+                </dc:when>
+                <dc:when test="$out = 'cross_section'">
+                  <dc:call-macro name="cross_sections"/>
+                  <dc:call-macro name="hyks"/>
+                </dc:when>
+                <dc:when test="$out = 'computed_discharge_curve'">
+                  <dc:call-macro name="mainvalues"/>
+                  <dc:call-macro name="basedata_2_fixations_wqkms"/>
+                </dc:when>
+                <dc:when test="$out = 'duration_curve'">
+                  <dc:call-macro name="mainvalues"/>
+                </dc:when>
+                <dc:when test="$out = 'reference_curve'">
+                  <dc:call-macro name="annotations"/>
+                  <dc:call-macro name="mainvalues"/>
+                </dc:when>
+                <dc:when test="$out = 'fix_wq_curve'">
+                  <dc:call-macro name="qsectors"/>
+                </dc:when>
+                <dc:when test="$out = 'longitudinal_section'">
+                  <dc:call-macro name="annotations"/>
+                </dc:when>
+                <dc:when test="$out = 'fix_longitudinal_section_curve'">
+                  <dc:call-macro name="annotations"/>
+                </dc:when>
+                <dc:when test="$out = 'bed_difference_epoch'">
+                  <dc:call-macro name="annotations"/>
+                </dc:when>
+                <dc:when test="$out = 'bed_difference_year'">
+                  <dc:call-macro name="annotations"/>
+                </dc:when>
+                <dc:when test="$out = 'bed_difference_height_year'">
+                  <dc:call-macro name="annotations"/>
+                </dc:when>
+                <dc:when test="$out = 'floodmap'">
+                  <dc:call-macro name="flood-map-recommended"/>
+                </dc:when>
+                <dc:when test="$out = 'floodmap-hws'">
+                  <dc:call-macro name="flood-map-recommended"/>
+                </dc:when>
+                <dc:when test="$out = 'minfo-heights'">
+                  <dc:call-macro name="minfo-heights"/>
+                  <dc:macro name="minfo-heights">
+                    <bedheights>
+                      <dc:call-macro name="bed-heights-single"/>
+                      <dc:call-macro name="bed-heights-epoch"/>
+                    </bedheights>
+                  </dc:macro>
+                </dc:when>
+                <dc:when test="$out = 'minfo-heights-epoch'">
+                  <bedheights>
+                    <dc:call-macro name="bed-heights-epoch"/>
+                  </bedheights>
+                </dc:when>
+              </dc:choose>
+            </dc:iterate>
+          </dc:when>
+          <dc:otherwise>
+            <dc:comment>
+              Non - Recommendations.
+            </dc:comment>
+            <dc:iterate var="out" container="artifact-outs">
+              <dc:choose>
+                <dc:when test="$out = 'cross_section'">
+                  <dc:call-macro name="basedata_0"/>
+                  <dc:call-macro name="basedata_1_additionals"/>
+                  <dc:call-macro name="basedata_2_fixations"/>
+                  <dc:call-macro name="basedata_3_officials"/>
+                  <dc:call-macro name="basedata_4_heightmarks-points"/>
+                  <dc:call-macro name="cross_sections"/>
+                  <dc:call-macro name="hyks"/>
+                </dc:when>
+                <dc:when test="$out = 'longitudinal_section'">
+                  <dc:call-macro name="longitudinal-section-prototype"/>
+                </dc:when>
+                <dc:when test="$out = 'w_differences'">
+                  <dc:call-macro name="longitudinal-section-prototype"/>
+                </dc:when>
+                <dc:when test="$out = 'discharge_longitudinal_section'">
+                  <dc:call-macro name="longitudinal-section-prototype"/>
+                </dc:when>
+                <dc:when test="$out = 'duration_curve'">
+                  <dc:call-macro name="mainvalues"/>
+                  <dc:call-macro name="basedata_2_fixations_relative_point"/>
+                  <dc:call-macro name="basedata_4_heightmarks-points-relative_points"/>
+                  <dc:call-macro name="basedata_5_flood-protections_relative_points"/>
+                </dc:when>
+                <dc:when test="$out = 'reference_curve'">
+                  <dc:call-macro name="annotations"/>
+                  <dc:call-macro name="basedata_1_additionals-relative_point"/>
+                  <dc:comment comment=" FIXATIONS ---------------------------"/>
+                  <dc:call-macro name="basedata_2_fixations_relative_point"/>
+                  <dc:comment comment=" HOEHENMARKEN ---------------------------"/>
+                  <dc:call-macro name="basedata_4_heightmarks-points-relative_points"/>
+                  <dc:call-macro name="basedata_5_flood-protections_relative_points"/>
+                </dc:when>
+                <dc:when test="$out = 'fix_wq_curve'">
+                  <dc:call-macro name="basedata_0_wq"/>
+                  <dc:call-macro name="basedata_1_additionals_marks"/>
+                  <dc:call-macro name="basedata_2_fixations_wqkms"/>
+                  <dc:call-macro name="basedata_3_officials"/>
+                  <dc:call-macro name="basedata_4_heightmarks-points"/>
+                  <dc:call-macro name="basedata_5_flood-protections_relative_points"/>
+                  <dc:call-macro name="discharge_table_gauge"/>
+                  <dc:call-macro name="discharge_fix_wq"/>
+                </dc:when>
+                <dc:when test="$out = 'fix_deltawt_curve'">
+                </dc:when>
+                <dc:when test="$out = 'fix_longitudinal_section_curve'">
+                  <dc:call-macro name="annotations"/>
+                </dc:when>
+                <dc:when test="$out = 'map'">
+                  <dc:call-macro name="flood-map-complete"/>
+                </dc:when>
+                <dc:when test="$out = 'flow_velocity'">
+                  <dc:call-macro name="annotations_per_type"/>
+                  <dc:call-macro name="flow_velocity_measurements"/>
+                </dc:when>
+                <dc:when test="$out = 'bed_longitudinal_section'">
+                  <dc:call-macro name="annotations_per_type"/>
+                </dc:when>
+                <dc:when test="$out = 'sedimentload_ls'">
+                  <dc:call-macro name="annotations_per_type"/>
+                  <dc:call-macro name="morph_width"/>
+                </dc:when>
+                <dc:comment>
+                  MINFO bedheight middle
+                </dc:comment>
+                <dc:when test="$out = 'bedheight_middle'">
+                  <dc:call-macro name="sounding-width"/>
+                  <dc:call-macro name="basedata_0"/>
+                  <dc:call-macro name="basedata_1_additionals"/>
+                  <dc:call-macro name="basedata_2_fixations"/>
+                  <dc:call-macro name="basedata_3_officials"/>
+                  <dc:call-macro name="annotations_per_type"/>
+                </dc:when>
+                <dc:when test="$out = 'bed_difference_year'">
+                  <dc:call-macro name="basedata_0"/>
+                  <dc:call-macro name="basedata_1_additionals"/>
+                  <dc:call-macro name="basedata_2_fixations"/>
+                  <dc:call-macro name="basedata_3_officials"/>
+                  <dc:call-macro name="annotations_per_type"/>
+                  <dc:call-macro name="morph_width"/>
+                </dc:when>
+                <dc:when test="$out = 'bed_difference_epoch'">
+                  <dc:call-macro name="basedata_0"/>
+                  <dc:call-macro name="basedata_1_additionals"/>
+                  <dc:call-macro name="basedata_2_fixations"/>
+                  <dc:call-macro name="basedata_3_officials"/>
+                  <dc:call-macro name="annotations_per_type"/>
+                  <dc:call-macro name="morph_width"/>
+                </dc:when>
+                <dc:when test="$out = 'floodmap'">
+                  <dc:choose>
+                    <dc:when test="dc:contains($parameters, 'dem')">
+                      <dc:call-macro name="flood-map-dem"/>
+                    </dc:when>
+                    <dc:when test="dc:contains($parameters, 'hws')">
+                      <hws>
+                        <dc:call-macro name="flood-map-hws-lines"/>
+                        <dc:call-macro name="flood-map-hws-points"/>
+                      </hws>
+                    </dc:when>
+                    <dc:otherwise>
+                      <dc:call-macro name="flood-map-complete"/>
+                    </dc:otherwise>
+                  </dc:choose>
+                </dc:when>
+                <dc:when test="$out = 'floodmap-hws'">
+                  <dc:choose>
+                    <dc:when test="dc:contains($parameters, 'dem')">
+                      <dc:call-macro name="flood-map-dem"/>
+                    </dc:when>
+                    <dc:when test="dc:contains($parameters, 'hws')">
+                      <hws>
+                        <dc:call-macro name="flood-map-hws-lines"/>
+                        <dc:call-macro name="flood-map-hws-points"/>
+                      </hws>
+                    </dc:when>
+                    <dc:otherwise>
+                      <dc:call-macro name="flood-map-complete"/>
+                    </dc:otherwise>
+                  </dc:choose>
+                </dc:when>
+                <dc:when test="$out = 'computed_discharge_curve'">
+                  <dc:call-macro name="discharge_computed"/>
+                  <dc:call-macro name="basedata_2_fixations_wqkms"/>
+
+                  <dc:call-macro name="basedata_5_flood-protections"/>
+
+                  <!-- former waterlevels -->
+                  <dc:call-macro name="basedata_0"/>
+
+                  <dc:call-macro name="basedata_1_additionals"/>
+
+                  <!-- former flood-water-marks -->
+                  <dc:call-macro name="basedata_4_heightmarks-points"/>
+                  <computed_discharge_curve>
+                    <dc:call-macro name="mainvalues"/>
+                  </computed_discharge_curve>
+                </dc:when>
+                <dc:when test="$out = 'minfo-heights'">
+                  <dc:call-macro name="minfo-heights"/>
+                  <dc:macro name="minfo-heights">
+                    <bedheights>
+                      <dc:call-macro name="bed-heights-single"/>
+                      <dc:call-macro name="bed-heights-epoch"/>
+                    </bedheights>
+                  </dc:macro>
+                </dc:when>
+                <dc:when test="$out = 'minfo-heights-epoch'">
+                  <bedheights>
+                    <dc:call-macro name="bed-heights-epoch"/>
+                  </bedheights>
+                </dc:when>
+              </dc:choose>
+            </dc:iterate>
+          </dc:otherwise>
+        </dc:choose>
+
 
         <dc:if test="dc:contains($artifact-outs, 'floodmap') or dc:contains($artifact-outs, 'floodmap-hws')">
-          <dc:choose>
-            <dc:when test="dc:contains($parameters, 'recommended')">
-              <dc:call-macro name="flood-map-recommended"/>
-            </dc:when>
-            <dc:when test="dc:contains($parameters, 'dem')">
-              <dc:call-macro name="flood-map-dem"/>
-            </dc:when>
-            <dc:when test="dc:contains($parameters, 'hws')">
-              <hws>
-                <dc:call-macro name="flood-map-hws-lines"/>
-                <dc:call-macro name="flood-map-hws-points"/>
-              </hws>
-            </dc:when>
-            <dc:otherwise>
-              <dc:call-macro name="flood-map-complete"/>
-            </dc:otherwise>
-          </dc:choose>
-
           <dc:macro name="flood-map-recommended">
             <dc:comment>
                FIXME: Following two macros look identical to me.
             </dc:comment>
             <kilometrage>
-              <riveraxis factory="riveraxis" ids="{$river_id}"/>
+              <riveraxis factory="riveraxis" ids="{$river_id}:OUT={$OUT}"/>
             </kilometrage>
             <rastermap>
-              <background factory="wmsbackground" ids="{$river_id}"/>
+              <background factory="wmsbackground" ids="{$river_id}:OUT={$OUT}"/>
             </rastermap>
           </dc:macro>
 
@@ -916,7 +987,9 @@
                          WHERE d.river_id = ${river_id}
                 </dc:statement>
                 <dc:for-each>
-                  <dem factory="demfactory" ids="{$dem_id}" name="{$name}"
+                  <dem factory="demfactory" 
+                    ids="{$dem_id}:OUT={$OUT}"
+                    name="{$name}"
                     info="{dc:replace($info, '$', '&lt;BR&gt;')}{dc:date-format('yyyy', $start_time)} - {dc:date-format('yyyy', $stop_time)}"/>
                 </dc:for-each>
               </dc:context>
@@ -1009,7 +1082,7 @@
                 SELECT DISTINCT 1 FROM river_axes_km WHERE river_id = ${river_id}
               </dc:statement>
                <dc:for-each>
-                  <kilometrage factory="wmskmfactory" ids="{$river_id}"/>
+                  <kilometrage factory="wmskmfactory" ids="{$river_id}:OUT={$OUT}"/>
               </dc:for-each>
             </dc:context>
           </dc:macro>
@@ -1030,7 +1103,7 @@
                 <dc:for-each>
                   <actual description="{$kind_name}"
                           factory="wmsqpsfactory"
-                          ids="{$river_id};{$kind_name};{$kind_id}"/>
+                          ids="{$river_id};{$kind_name};{$kind_id}:OUT={$OUT}"/>
                 </dc:for-each>
               </dc:if>
             </dc:context>
@@ -1051,7 +1124,7 @@
                   <dc:for-each>
                     <misc-qps description="{$layer_name}"
                               factory="wmsqpsfactory"
-                              ids="{$river_id};{$layer_name};{$kind_id}"/>
+                              ids="{$river_id};{$layer_name};{$kind_id}:OUT={$OUT}"/>
                   </dc:for-each>
                 </other>
               </dc:if>
@@ -1072,7 +1145,7 @@
               <dc:if test="dc:has-result()">
                 <dc:for-each>
                   <actual description="{$kind_name}"
-                          ids="{$river_id};{$kind_name};{$kind_id}"
+                    ids="{$river_id};{$kind_name};{$kind_id}:OUT={$OUT}"
                           factory="riveraxis"/>
                 </dc:for-each>
               </dc:if>
@@ -1092,7 +1165,7 @@
                 <other>
                   <dc:for-each>
                     <misc-axis description="{$layer_name}"
-                               ids="{$river_id};{$layer_name};{$kind_id}"
+                               ids="{$river_id};{$layer_name};{$kind_id}:OUT={$OUT}"
                                factory="riveraxis"/>
                   </dc:for-each>
                 </other>
@@ -1111,7 +1184,7 @@
               </dc:statement>
               <dc:for-each>
                 <line factory="wmshydrboundariesfactory" 
-                      ids="{$river_id};{$name};2"
+                      ids="{$river_id};{$name};2:OUT={$OUT}"
                       name="{$name}"/>
               </dc:for-each>
             </dc:context>
@@ -1125,7 +1198,7 @@
               </dc:statement>
               <dc:for-each>
                 <line factory="wmshydrboundariespolyfactory"
-                      ids="{$river_id};{$name};2"
+                      ids="{$river_id};{$name};2:OUT={$OUT}"
                       name="{$name}"/>
               </dc:for-each>
             </dc:context>
@@ -1145,7 +1218,7 @@
                 <lines>
                   <dc:for-each>
                     <line factory="wmshydrboundariesfactory"
-                          ids="{$river_id};{$name};1"
+                          ids="{$river_id};{$name};1:OUT={$OUT}"
                           name="{$name}"/>
                   </dc:for-each>
                 </lines>
@@ -1169,7 +1242,7 @@
                   <dc:for-each>
                     <boundary name="{$sectie}"
                               factory="wmshydrboundariespolyfactory"
-                              ids="{$river_id};{$sectie};1;{$sectie_id};-1"/>
+                              ids="{$river_id};{$sectie};1;{$sectie_id};-1:OUT={$OUT}"/>
                   </dc:for-each>
                 </sobek_areas>
               </dc:if>
@@ -1189,7 +1262,7 @@
                   <dc:for-each>
                     <boundary name="{$sobek}"
                               factory="wmshydrboundariespolyfactory"
-                              ids="{$river_id};{$sobek};1;-1;{$sobek_id}"/>
+                              ids="{$river_id};{$sobek};1;-1;{$sobek_id}:OUT={$OUT}"/>
                   </dc:for-each>
                 </sobek_flooded>
               </dc:if>
@@ -1207,7 +1280,7 @@
               <dc:for-each>
                 <boundary name="{$name}"
                           factory="wmshydrboundariespolyfactory"
-                          ids="{$river_id};{$name}"/>
+                          ids="{$river_id};{$name}:OUT={$OUT}"/>
               </dc:for-each>
             </dc:context>
           </dc:macro>
@@ -1240,7 +1313,7 @@
                   <dc:for-each>
                     <floody factory="wmsfloodplainfactory"
                       description="{$kind_name}"
-                      ids="{$river_id};{$kind_name};{$kind_id}"/>
+                      ids="{$river_id};{$kind_name};{$kind_id}:OUT={$OUT}"/>
                   </dc:for-each>
                 </dc:if>
               </dc:context>
@@ -1260,7 +1333,7 @@
                     <dc:for-each>
                       <floody factory="wmsfloodplainfactory"
                         description="{$layer_name}"
-                        ids="{$river_id};{$layer_name};{$kind_id}"/>
+                        ids="{$river_id};{$layer_name};{$kind_id}:OUT={$OUT}"/>
                     </dc:for-each>
                   </other>
                 </dc:if>
@@ -1277,7 +1350,7 @@
             <dc:macro name="hwslines_by_kind_factory">
               <dc:for-each>
                 <hws factory="wmshwslinesfactory"
-                     ids="{$river_id};{$hws_name}"
+                     ids="{$river_id};{$hws_name}:OUT={$OUT}"
                      name="{$hws_name}"/>
               </dc:for-each>
             </dc:macro>
@@ -1408,7 +1481,7 @@
             <dc:macro name="hwspoints_by_kind_factory">
               <dc:for-each>
                 <hws factory="wmshwspointsfactory"
-                     ids="{$river_id};{$hws_name}"
+                     ids="{$river_id};{$hws_name}:OUT={$OUT}"
                      name="{$hws_name}"/>
               </dc:for-each>
             </dc:macro>
@@ -1544,7 +1617,7 @@
               <dc:for-each>
                 <buildings description="{$building_kind}"
                            factory="wmsbuildingsfactory"
-                           ids="{$river_id};{$building_kind};{$building_kind_id}"/>
+                           ids="{$river_id};{$building_kind};{$building_kind_id}:OUT={$OUT}"/>
               </dc:for-each>
             </dc:context>
             <dc:context>
@@ -1563,7 +1636,7 @@
                   <dc:for-each>
                     <buildings description="{$building_name}"
                       factory="wmsbuildingsfactory"
-                      ids="{$river_id};{$building_name}"/>
+                      ids="{$river_id};{$building_name}:OUT={$OUT}"/>
                   </dc:for-each>
                 </other>
               </dc:if>
@@ -1582,7 +1655,7 @@
                   <dc:for-each>
                     <jetty description="{$jetty_kind}"
                            factory="wmsjettiesfactory"
-                           ids="{$river_id};{$jetty_kind};{$jetty_kind_id}"/>
+                           ids="{$river_id};{$jetty_kind};{$jetty_kind_id}:OUT={$OUT}"/>
                   </dc:for-each>
                 </jetties>
               </dc:if>
@@ -1597,16 +1670,16 @@
               </dc:statement>
               <dc:for-each>
                 <fixpoints factory="wmsfixpointsfactory"
-                  ids="{$river_id};{$name}"/>
+                  ids="{$river_id};{$name}:OUT={$OUT}"/>
               </dc:for-each>
             </dc:context>
           </dc:macro>
 
           <dc:macro name="flood-map-gaugelocations">
-            <gauge_points factory="externalwmsfactory" ids="http://www.pegelonline.wsv.de/webservices/gis/wms;Pegelpunkte;Pegelpunkte (WSV)"/>
-            <gauge_names factory="externalwmsfactory" ids="http://www.pegelonline.wsv.de/webservices/gis/wms;Pegelnamen;Pegelnamen (WSV)"/>
-            <gauge_level factory="externalwmsfactory" ids="http://www.pegelonline.wsv.de/webservices/gis/wms;Pegelwasserstand;Aktueller Wasserstand (WSV)"/>
-            <gauge_tendency factory="externalwmsfactory" ids="http://www.pegelonline.wsv.de/webservices/gis/wms;TendenzWasserstand;Tendenz des Wasserstands (WSV)"/>
+            <gauge_points factory="externalwmsfactory" ids="http://www.pegelonline.wsv.de/webservices/gis/wms;Pegelpunkte;Pegelpunkte (WSV):OUT={$OUT}"/>
+            <gauge_names factory="externalwmsfactory" ids="http://www.pegelonline.wsv.de/webservices/gis/wms;Pegelnamen;Pegelnamen (WSV):OUT={$OUT}"/>
+            <gauge_level factory="externalwmsfactory" ids="http://www.pegelonline.wsv.de/webservices/gis/wms;Pegelwasserstand;Aktueller Wasserstand (WSV):OUT={$OUT}"/>
+            <gauge_tendency factory="externalwmsfactory" ids="http://www.pegelonline.wsv.de/webservices/gis/wms;TendenzWasserstand;Tendenz des Wasserstands (WSV):OUT={$OUT}"/>
           </dc:macro>
 
           <dc:macro name="flood-map-uesk">
@@ -1634,7 +1707,7 @@
                             <bfg>
                               <dc:for-each>
                                 <floodmaps factory="wmsfloodmapsfactory"
-                                  ids="{$river_id};{$name}"
+                                  ids="{$river_id};{$name}:OUT={$OUT}"
                                   name="{$name}"/>
                               </dc:for-each>
                             </bfg>
@@ -1650,7 +1723,7 @@
                             <federal>
                               <dc:for-each>
                                 <floodmaps factory="wmsfloodmapsfactory"
-                                  ids="{$river_id};{$name}"
+                                  ids="{$river_id};{$name}:OUT={$OUT}"
                                   name="{$name}"/>
                               </dc:for-each>
                             </federal>
@@ -1676,7 +1749,7 @@
                             <bfg>
                               <dc:for-each>
                                 <floodmaps factory="wmsfloodmapsfactory"
-                                  ids="{$river_id};{$name}"
+                                  ids="{$river_id};{$name}:OUT={$OUT}"
                                   name="{$name}"/>
                               </dc:for-each>
                             </bfg>
@@ -1693,7 +1766,7 @@
                             <federal>
                               <dc:for-each>
                                 <floodmaps factory="wmsfloodmapsfactory"
-                                  ids="{$river_id};{$name}"
+                                  ids="{$river_id};{$name}:OUT={$OUT}"
                                   name="{$name}"/>
                               </dc:for-each>
                             </federal>
@@ -1724,7 +1797,7 @@
                             </dc:statement>
                             <dc:for-each>
                               <floodmaps factory="wmsfloodmapsfactory"
-                                ids="{$river_id};{$name}"
+                                ids="{$river_id};{$name}:OUT={$OUT}"
                                 name="{$name}"/>
                             </dc:for-each>
                           </dc:context>
@@ -1762,7 +1835,7 @@
                   <dc:for-each>
                     <floodmark name="{$year}"
                       factory="wmsfloodmarkfactory"
-                      ids="{$river_id};{$year};{$year}"/>
+                      ids="{$river_id};{$year};{$year}:OUT={$OUT}"/>
                   </dc:for-each>
                 </floodmarks>
               </dc:if>
@@ -1775,7 +1848,7 @@
           </buildings>
           <catchments>
               <catchment_wms factory="externalwmsfactory"
-                  ids="http://geoportal.bafg.de/wmsproxy/INSPIRE/DrainageBasin;HY.PHYSICALWATERS.CATCHMENTS;Einzugsgebiete (WMS)" />
+                  ids="http://geoportal.bafg.de/wmsproxy/INSPIRE/DrainageBasin;HY.PHYSICALWATERS.CATCHMENTS;Einzugsgebiete (WMS):OUT={$OUT}" />
               <gaugelocations>
                   <dc:call-macro name="flood-map-gaugelocations"/>
               </gaugelocations>
@@ -1797,21 +1870,6 @@
 
         </dc:if>
 
-        <dc:if test="dc:contains($artifact-outs, 'minfo-heights')">
-          <dc:call-macro name="minfo-heights"/>
-          <dc:macro name="minfo-heights">
-            <bedheights>
-              <dc:call-macro name="bed-heights-single"/>
-              <dc:call-macro name="bed-heights-epoch"/>
-            </bedheights>
-          </dc:macro>
-        </dc:if>
-        <dc:if test="dc:contains($artifact-outs, 'minfo-heights-epoch')">
-          <bedheights>
-            <dc:call-macro name="bed-heights-epoch"/>
-          </bedheights>
-        </dc:if>
-
         <dc:macro name="bed-heights-single">
           <single>
             <dc:context>
@@ -1823,7 +1881,7 @@
               </dc:statement>
               <dc:for-each>
                 <height factory="bedheight"
-                        ids="bedheight-single-{$bedh_id}-{$bedh_year}"
+                        ids="bedheight-single-{$bedh_id}-{$bedh_year}:OUT={$OUT}"
                         description="{$bedh_descr}"/>
               </dc:for-each>
             </dc:context>
@@ -1841,7 +1899,7 @@
               </dc:statement>
               <dc:for-each>
                 <height factory="bedheight"
-                        ids="bedheight-epoch-{$bedh_id}-{$bedh_interval_id}"
+                        ids="bedheight-epoch-{$bedh_id}-{$bedh_interval_id}:OUT={$OUT}"
                         description="{$bedh_descr}"/>
               </dc:for-each>
             </dc:context>
@@ -1898,33 +1956,33 @@
             </dc:macro>
 
             <!-- OFFICIAL LINES -->
-            <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
+            <dc:macro name="officiallines_user">
               <dc:comment comment=".wst -------------------------------"/>
               <officiallines>
                 <dc:for-each>
                   <dc:context>
                     <dc:statement>
                       SELECT m.id AS a_id,
-                             m.state AS a_state,
-                             m.gid AS a_gid,
-                             m.creation AS a_creation,
-                             ardg.v AS gaugy,
-                             arv.v AS wqsingle
+                      m.state AS a_state,
+                      m.gid AS a_gid,
+                      m.creation AS a_creation,
+                      ardg.v AS gaugy,
+                      arv.v AS wqsingle
                       FROM   master_artifacts m,
-                             artifact_data ardg,
-                             artifact_data arv
+                      artifact_data ardg,
+                      artifact_data arv
                       WHERE  m.collection_id = ${collection_id}
-                        AND m.gid = CAST(${artifact-id} AS uuid)
-                        AND ardg.artifact_id = m.id
-                        AND ardg.k = 'ld_gaugename'
-                        AND arv.artifact_id = m.id
-                        AND arv.k = 'wq_single'
-                        AND EXISTS (
-                          SELECT id
-                          FROM artifact_data ad
-                          WHERE ad.artifact_id = m.id
-                            AND k = 'river'
-                            AND v = ${river})
+                      AND m.gid = CAST(${artifact-id} AS uuid)
+                      AND ardg.artifact_id = m.id
+                      AND ardg.k = 'ld_gaugename'
+                      AND arv.artifact_id = m.id
+                      AND arv.k = 'wq_single'
+                      AND EXISTS (
+                      SELECT id
+                      FROM artifact_data ad
+                      WHERE ad.artifact_id = m.id
+                      AND k = 'river'
+                      AND v = ${river})
                     </dc:statement>
                     <dc:for-each>
                       <dc:context connection="system">
@@ -1936,7 +1994,7 @@
                         <dc:for-each>
                           <dc:element name="${olname}">
                             <dc:attribute name="name" value="${olname}"/>
-                            <dc:attribute name="ids" value="additionals-wstv-${wstcolpos}-${wstid}"/>
+                            <dc:attribute name="ids" value="additionals-wstv-${wstcolpos}-${wstid}:OUT=${out}"/>
                             <dc:attribute name="factory" value="staticwkms"/>
                           </dc:element>
                         </dc:for-each>
@@ -1945,7 +2003,7 @@
                   </dc:context>
                 </dc:for-each>
               </officiallines>
-            </dc:if>
+            </dc:macro>
             <!-- END OFFICIAL LINES -->
 
             <dc:comment>
@@ -1968,7 +2026,7 @@
                             <dc:attribute name="description" value="${facet_description}"/>
                             <dc:attribute name="factory" value="winfo"/>
                             <dc:attribute name="artifact-id" value="${aid}"/>
-                            <dc:attribute name="ids" value="${aid}"/>
+                            <dc:attribute name="ids" value="${aid}:OUT=${out}"/>
                             <dc:attribute name="out" value="w_differences"/>
                           </dc:element>
                         </dc:for-each>
@@ -1999,7 +2057,7 @@
                             <dc:attribute name="description" value="${facet_description}"/>
                             <dc:attribute name="factory" value="winfo"/>
                             <dc:attribute name="artifact-id" value="${aid}"/>
-                            <dc:attribute name="ids" value="${aid}"/>
+                            <dc:attribute name="ids" value="${aid}:OUT=${out}"/>
                             <dc:attribute name="out" value="reference_curve"/>
                           </dc:element>
                         </dc:for-each>
@@ -2030,7 +2088,7 @@
                             <dc:attribute name="description" value="${facet_description}"/>
                             <dc:attribute name="factory" value="winfo"/>
                             <dc:attribute name="artifact-id" value="${aid}"/>
-                            <dc:attribute name="ids" value="${aid}"/>
+                            <dc:attribute name="ids" value="${aid}:OUT=${out}"/>
                             <dc:attribute name="out" value="computed_discharge_curve"/>
                           </dc:element>
                         </dc:for-each>
@@ -2068,7 +2126,7 @@
                               <dc:for-each>
                                 <dc:element name="${facet_name}">
                                   <dc:attribute name="description" value="${facet_description}"/>
-                                  <dc:attribute name="ids" value="${facet_num}"/>
+                                  <dc:attribute name="ids" value="${facet_num}:OUT=${out}"/>
                                   <dc:attribute name="factory" value="winfo"/>
                                   <dc:attribute name="artifact-id" value="${a_gid}"/>
                                   <dc:attribute name="out" value="cross_section"/>
@@ -2107,7 +2165,7 @@
                               <dc:for-each>
                                 <dc:element name="${facet_name}">
                                   <dc:attribute name="description" value="${facet_description}"/>
-                                  <dc:attribute name="ids" value="${facet_num}"/>
+                                  <dc:attribute name="ids" value="${facet_num}:OUT=${out}"/>
                                   <dc:attribute name="factory" value="winfo"/>
                                   <dc:attribute name="artifact-id" value="${a_gid}"/>
                                   <dc:attribute name="out" value="longitudinal_section"/>
@@ -2151,7 +2209,7 @@
                               <dc:for-each>
                                 <dc:element name="${facet_name}">
                                   <dc:attribute name="description" value="${facet_description}"/>
-                                  <dc:attribute name="ids" value="${facet_num}"/>
+                                  <dc:attribute name="ids" value="${facet_num}:OUT=${out}"/>
                                   <dc:attribute name="factory" value="fixanalysis"/>
                                   <dc:attribute name="artifact-id" value="${a_gid}"/>
                                   <dc:attribute name="out" value="fix_longitudinal_section_curve"/>
@@ -2195,7 +2253,7 @@
                               <dc:for-each>
                                 <dc:element name="${facet_name}">
                                   <dc:attribute name="description" value="${facet_description}"/>
-                                  <dc:attribute name="ids" value="${facet_num}"/>
+                                  <dc:attribute name="ids" value="${facet_num}:OUT=${out}"/>
                                   <dc:attribute name="factory" value="fixanalysis"/>
                                   <dc:attribute name="artifact-id" value="${a_gid}"/>
                                   <dc:attribute name="out" value="fix_deltawt_curve"/>
@@ -2236,7 +2294,7 @@
                               <dc:for-each>
                                 <dc:element name="${facet_name}">
                                   <dc:attribute name="description" value="${facet_description}"/>
-                                  <dc:attribute name="ids" value="${facet_num}"/>
+                                  <dc:attribute name="ids" value="${facet_num}:OUT=${out}"/>
                                   <dc:attribute name="factory" value="fixanalysis"/>
                                   <dc:attribute name="artifact-id" value="${a_gid}"/>
                                   <dc:attribute name="out" value="fix_deltawt_curve"/>
@@ -2275,7 +2333,7 @@
                               <dc:for-each>
                                 <dc:element name="${facet_name}">
                                   <dc:attribute name="description" value="${facet_description}"/>
-                                  <dc:attribute name="ids" value="${facet_num}"/>
+                                  <dc:attribute name="ids" value="${facet_num}:OUT=${out}"/>
                                   <dc:attribute name="factory" value="fixanalysis"/>
                                   <dc:attribute name="artifact-id" value="${a_gid}"/>
                                   <dc:attribute name="out" value="fix_derivate_curve"/>
@@ -2318,7 +2376,7 @@
                               <dc:for-each>
                                 <dc:element name="${facet_name}">
                                   <dc:attribute name="description" value="${facet_description}"/>
-                                  <dc:attribute name="ids" value="${facet_num}"/>
+                                  <dc:attribute name="ids" value="${facet_num}:OUT=${out}"/>
                                   <dc:attribute name="factory" value="fixanalysis"/>
                                   <dc:attribute name="artifact-id" value="${a_gid}"/>
                                   <dc:attribute name="out" value="fix_wq_curve"/>
@@ -2358,7 +2416,7 @@
                             <dc:attribute name="description" value="${facet_description}"/>
                             <dc:attribute name="factory" value="winfo"/>
                             <dc:attribute name="artifact-id" value="${aid}"/>
-                            <dc:attribute name="ids" value="${aid}"/>
+                            <dc:attribute name="ids" value="${aid}:OUT=${out}"/>
                             <dc:attribute name="out" value="duration_curve"/>
                           </dc:element>
                         </dc:for-each>
@@ -2398,7 +2456,7 @@
                               <dc:for-each>
                                 <dc:element name="${facet_name}">
                                   <dc:attribute name="description" value="${facet_description}"/>
-                                  <dc:attribute name="ids" value="${facet_num}"/>
+                                  <dc:attribute name="ids" value="${facet_num}:OUT=${out}"/>
                                   <dc:attribute name="factory" value="winfo"/>
                                   <dc:attribute name="artifact-id" value="${a_gid}"/>
                                   <dc:attribute name="out" value="longitudinal_section"/>
@@ -2441,7 +2499,7 @@
                             <dc:attribute name="description" value="${facet_description}"/>
                             <dc:attribute name="factory" value="winfo"/>
                             <dc:attribute name="artifact-id" value="${aid}"/>
-                            <dc:attribute name="ids" value="${aid}"/>
+                            <dc:attribute name="ids" value="${aid}:OUT=${out}"/>
                             <dc:attribute name="out" value="floodmap"/>
                           </dc:element>
                         </dc:for-each>
@@ -2480,7 +2538,7 @@
                               <dc:attribute name="description" value="${facet_description}"/>
                               <dc:attribute name="factory" value="fixanalysis"/>
                               <dc:attribute name="artifact-id" value="${aid}"/>
-                              <dc:attribute name="ids" value="${facet_num}"/>
+                              <dc:attribute name="ids" value="${facet_num}:OUT=${out}"/>
                               <dc:attribute name="out" value="longitudinal_section"/>
                             </dc:element>
                           </dc:for-each>
@@ -2513,7 +2571,7 @@
                       <dc:for-each>
                         <dc:element name="${facet_name}">
                           <dc:attribute name="description" value="${facet_description}"/>
-                          <dc:attribute name="ids" value="${facet_num}"/>
+                          <dc:attribute name="ids" value="${facet_num}:OUT=${out}"/>
                           <dc:attribute name="factory" value="winfo"/>
                           <dc:attribute name="artifact-id" value="${a_gid}"/>
                           <dc:attribute name="out" value="floodmap"/>
@@ -2559,7 +2617,7 @@
                                 <dc:element name="${facet_name}">
                                   <dc:attribute name="factory" value="minfo"/>
                                   <dc:attribute name="description" value="${facet_description}"/>
-                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}:OUT=${out}"/>
                                   <dc:attribute name="artifact-id" value="${aid}"/>
                                   <dc:attribute name="out" value="bed_longitudinal_section"/>
                                 </dc:element>
@@ -2607,7 +2665,7 @@
                                 <dc:element name="${facet_name}">
                                   <dc:attribute name="factory" value="minfo"/>
                                   <dc:attribute name="description" value="${facet_description}"/>
-                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}:OUT=${out}"/>
                                   <dc:attribute name="artifact-id" value="${aid}"/>
                                   <dc:attribute name="out" value="bed_longitudinal_section"/>
                                 </dc:element>
@@ -2656,7 +2714,7 @@
                                 <dc:element name="${facet_name}">
                                   <dc:attribute name="factory" value="minfo"/>
                                   <dc:attribute name="description" value="${facet_description}"/>
-                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}:OUT=${out}"/>
                                   <dc:attribute name="artifact-id" value="${aid}"/>
                                   <dc:attribute name="out" value="bed_longitudinal_section"/>
                                 </dc:element>
@@ -2705,7 +2763,7 @@
                                 <dc:element name="${facet_name}">
                                   <dc:attribute name="factory" value="minfo"/>
                                   <dc:attribute name="description" value="${facet_description}"/>
-                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}:OUT=${out}"/>
                                   <dc:attribute name="artifact-id" value="${aid}"/>
                                   <dc:attribute name="out" value="bed_longitudinal_section"/>
                                 </dc:element>
@@ -2755,7 +2813,7 @@
                               <dc:element name="${facet_name}">
                                 <dc:attribute name="factory" value="minfo"/>
                                 <dc:attribute name="description" value="${facet_description}"/>
-                                <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                                <dc:attribute name="ids" value="${facet_num}-${facet_name}:OUT=${out}"/>
                                 <dc:attribute name="artifact-id" value="${aid}"/>
                                 <dc:attribute name="out" value="flow_velocity"/>
                               </dc:element>
@@ -2801,7 +2859,7 @@
                                 <dc:element name="${facet_name}">
                                   <dc:attribute name="factory" value="minfo"/>
                                   <dc:attribute name="description" value="${facet_description}"/>
-                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}:OUT=${out}"/>
                                   <dc:attribute name="artifact-id" value="${aid}"/>
                                   <dc:attribute name="out" value="sedimentload_ls"/>
                                 </dc:element>
@@ -2851,7 +2909,7 @@
                                 <dc:element name="${facet_name}">
                                   <dc:attribute name="factory" value="minfo"/>
                                   <dc:attribute name="description" value="${facet_description}"/>
-                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}:OUT=${out}"/>
                                   <dc:attribute name="artifact-id" value="${aid}"/>
                                   <dc:choose>
                                     <dc:when test="dc:contains($o_name, 'bed_difference_year')">
@@ -2905,7 +2963,7 @@
                                 <dc:element name="${facet_name}">
                                   <dc:attribute name="factory" value="fixanalysis"/>
                                   <dc:attribute name="description" value="${facet_description}"/>
-                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}:OUT=${out}"/>
                                   <dc:attribute name="artifact-id" value="${aid}"/>
                                   <dc:attribute name="out" value="longitudinal_section"/>
                                 </dc:element>
@@ -2952,7 +3010,7 @@
                                 <dc:element name="${facet_name}">
                                   <dc:attribute name="factory" value="winfo"/>
                                   <dc:attribute name="description" value="${facet_description}"/>
-                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
+                                  <dc:attribute name="ids" value="${facet_num}-${facet_name}:OUT=${out}"/>
                                   <dc:attribute name="artifact-id" value="${aid}"/>
                                   <dc:attribute name="out" value="longitudinal_section"/>
                                 </dc:element>
@@ -2967,73 +3025,106 @@
               </waterlevels-discharge>
             </dc:macro>
 
-            <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'discharge_longitudinal_section') or (dc:contains($artifact-outs, 'w_differences')))">
-              <dc:call-macro name="longitudinal"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'fix_deltawt_curve')">
-              <dc:call-macro name="delta-wt"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'w_differences') or (dc:contains($artifact-outs, 'discharge_longitudinal_section')))">
-              <dc:call-macro name="differences"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'reference_curve')">
-              <dc:call-macro name="reference-curves"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
-              <dc:call-macro name="computed-discharge-curve"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'cross_section')">
-              <dc:call-macro name="waterlevels"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'fix_longitudinal_section_curve')">
-              <dc:call-macro name="longitudinal-section"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'fix_derivate_curve')">
-              <dc:call-macro name="fix-derivate-curve"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve')">
-              <dc:call-macro name="fix-wq-curve"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'duration_curve')">
-              <dc:call-macro name="duration-curve"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'waterlevels') or (dc:contains($artifact-outs, 'fix_wq_curve'))">
-              <dc:call-macro name="waterlevels-fix"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'floodmap') or dc:contains($artifact-outs, 'map')">
-              <dc:call-macro name="flood-map"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'bedheight_middle')">
-              <dc:call-macro name="waterlevels-discharge"/>
-              <dc:call-macro name="waterlevels-fix"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'floodmap-hws')">
-              <dc:call-macro name="floodmap-hws-user"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'flow_velocity')">
-              <dc:call-macro name="bedquality-bed"/>
-              <dc:call-macro name="bedquality-load"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'bed_longitudinal_section')">
-              <dc:call-macro name="bedquality-bed"/>
-              <dc:call-macro name="bedquality-load"/>
-              <dc:call-macro name="bedquality-density"/>
-              <dc:call-macro name="bedquality-porosity"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'sedimentload_ls')">
-              <dc:call-macro name="differences"/>
-              <dc:call-macro name="bedheight-differences"/>
-              <dc:call-macro name="flow-velocity"/>
-              <dc:call-macro name="sediment-load"/>
-            </dc:if>
-            <dc:if test="dc:contains($artifact-outs, 'bed_difference_year') or
-                         dc:contains($artifact-outs, 'bed_difference_epoch')">
-              <dc:call-macro name="waterlevels-discharge"/>
-              <dc:call-macro name="bedheight-differences"/>
-              <dc:call-macro name="differences"/>
-              <dc:call-macro name="waterlevels-fix"/>
-              <dc:call-macro name="delta-wt-ls"/>
-            </dc:if>
+            <dc:iterate var="out" container="artifact-outs">
+              <dc:choose>
+                <dc:when test="$out = 'longitudinal_section'">
+                  <dc:call-macro name="longitudinal"/>
+                  <dc:call-macro name="differences"/>
+                  <dc:call-macro name="officiallines_user"/>
+                </dc:when>
+                <dc:when test="$out = 'discharge_longitudinal_section'">
+                  <dc:call-macro name="longitudinal"/>
+                  <dc:call-macro name="differences"/>
+                </dc:when>
+                <dc:when test="$out = 'w_differences'">
+                  <dc:call-macro name="longitudinal"/>
+                  <dc:call-macro name="differences"/>
+                </dc:when>
+                <dc:when test="$out = 'fix_deltawt_curve'">
+                  <dc:call-macro name="delta-wt"/>
+                </dc:when>
+                <dc:when test="$out = 'reference_curve'">
+                  <dc:call-macro name="reference-curves"/>
+                </dc:when>
+                <dc:when test="$out = 'computed_discharge_curve'">
+                  <dc:call-macro name="computed-discharge-curve"/>
+                </dc:when>
+                <dc:when test="$out = 'cross_section'">
+                  <dc:call-macro name="waterlevels"/>
+                </dc:when>
+                <dc:when test="$out = 'fix_longitudinal_section_curve'">
+                  <dc:call-macro name="longitudinal-section"/>
+                </dc:when>
+                <dc:when test="$out = 'fix_derivate_curve'">
+                  <dc:call-macro name="fix-derivate-curve"/>
+                </dc:when>
+                <dc:when test="$out = 'fix_wq_curve'">
+                  <dc:call-macro name="fix-wq-curve"/>
+                </dc:when>
+                <dc:when test="$out = 'duration_curve'">
+                  <dc:call-macro name="duration-curve"/>
+                </dc:when>
+                <dc:when test="$out = 'waterlevels'">
+                  <!-- base data -->
+                  <dc:call-macro name="basedata_0"/>
+                  <!-- extra-longitudinal-sections -->
+                  <dc:call-macro name="basedata_1_additionals"/>
+                  <!-- fixations -->
+                  <dc:call-macro name="basedata_2_fixations"/>
+                  <!-- flood water marks-->
+                  <dc:call-macro name="basedata_4_heightmarks-points"/>
+                  <!-- flood protection -->
+                  <dc:call-macro name="basedata_5_flood-protections"/>
+                  <dc:call-macro name="waterlevels-fix"/>
+                </dc:when>
+                <dc:when test="$out = 'fix_wq_curve'">
+                  <dc:call-macro name="waterlevels-fix"/>
+                </dc:when>
+                <dc:when test="$out = 'floodmap'">
+                  <dc:call-macro name="flood-map"/>
+                </dc:when>
+                <dc:when test="$out = 'map'">
+                  <dc:call-macro name="flood-map"/>
+                </dc:when>
+                <dc:when test="$out = 'bedheight_middle'">
+                  <dc:call-macro name="waterlevels-discharge"/>
+                  <dc:call-macro name="waterlevels-fix"/>
+                </dc:when>
+                <dc:when test="$out = 'floodmap-hws'">
+                  <dc:call-macro name="floodmap-hws-user"/>
+                </dc:when>
+                <dc:when test="$out = 'flow_velocity'">
+                  <dc:call-macro name="bedquality-bed"/>
+                  <dc:call-macro name="bedquality-load"/>
+                </dc:when>
+                <dc:when test="$out = 'bed_longitudinal_section'">
+                  <dc:call-macro name="bedquality-bed"/>
+                  <dc:call-macro name="bedquality-load"/>
+                  <dc:call-macro name="bedquality-density"/>
+                  <dc:call-macro name="bedquality-porosity"/>
+                </dc:when>
+                <dc:when test="$out = 'sedimentload_ls'">
+                  <dc:call-macro name="differences"/>
+                  <dc:call-macro name="bedheight-differences"/>
+                  <dc:call-macro name="flow-velocity"/>
+                  <dc:call-macro name="sediment-load"/>
+                </dc:when>
+                <dc:when test="$out = 'bed_difference_year'">
+                  <dc:call-macro name="waterlevels-discharge"/>
+                  <dc:call-macro name="bedheight-differences"/>
+                  <dc:call-macro name="differences"/>
+                  <dc:call-macro name="waterlevels-fix"/>
+                  <dc:call-macro name="delta-wt-ls"/>
+                </dc:when>
+                <dc:when test="$out = 'bed_difference_epoch'">
+                  <dc:call-macro name="waterlevels-discharge"/>
+                  <dc:call-macro name="bedheight-differences"/>
+                  <dc:call-macro name="differences"/>
+                  <dc:call-macro name="waterlevels-fix"/>
+                  <dc:call-macro name="delta-wt-ls"/>
+                </dc:when>
+              </dc:choose>
+            </dc:iterate>
           </dc:context>
         </dc:call-macro>
 

http://dive4elements.wald.intevation.org