Просмотр исходного кода

poprawione, ze dziala dla wiekszej ilosci referencji, ale pewnie TODO dla jeszcze wiekszych powiazan z racji koniecznosci wprowadzenia podbuilda $path__node()__+position()

a.binder 9 лет назад
Родитель
Сommit
69ac7705b1

+ 56 - 32
SE/schema/ant-url_action/default_db.in7_dziennik_koresp/test-druk/build_recurse_ant.xsl

@@ -344,34 +344,41 @@
     <xsl:template match="RelatedFeature" mode="after_first_ant_assing_vars">
         <xsl:param name="loop_xpath" select="$loop_xpath"/>
         <RelatedFeatureRoot>
-            <xsl:message>#228 @xml_id=<xsl:value-of select="@xml_id"/>; templ match RelatedFeature mode after_first_ant_assing_vars dla @typeName=<xsl:value-of select="@typeName"/>;</xsl:message>
+            <xsl:message>#228  try to open $wfs_output=doc(<xsl:value-of select="$wfs_output"/>); @xml_id=<xsl:value-of select="@xml_id"/>; templ match RelatedFeature mode after_first_ant_assing_vars dla @typeName=<xsl:value-of select="@typeName"/>;</xsl:message>
         <!-- first assign xpath to features from  -->
         <xsl:variable name="wfs_output_nodes" select="doc($wfs_output)"/>
+        <xsl:variable name="current_RelatedFeature" select="*"/>
+       <xsl:variable name="xml_id" select="@xml_id"/>
         <!--<input_obj_with_xpath_debug>
             <xsl:copy-of select="$wfs_output_nodes"/>
         </input_obj_with_xpath_debug>-->
-        <xsl:variable name="input_obj_with_xpath">
-            <xsl:apply-templates mode="after_first_ant_assing_xpath" select="$wfs_output_nodes"/>
-        </xsl:variable>
-        <!--<input_obj_with_xpath_debug>
-            <xsl:attribute name="xpath" select="$xpath"/>
-            <!-\-<xsl:attribute name="xpath_dita" select="$xpath_dita"/>-\->
-            <xsl:attribute name="xpath_value" select="$xpath_value"/>
-            <!-\-<xsl:attribute name="xpath_value_dita" select="$xpath_value_dita"/>-\->
-            <xsl:attribute name="typeName" select="$typeName"/>
-            <!-\-<xsl:attribute name="typeName_dita" select="$typeName_dita"/>-\->
-            <!-\-<xsl:attribute name="featureID_name" select="$featureID_name"/>-\->
-            <!-\-<xsl:attribute name="featureID_name_dita" select="$featureID_name_dita"/>-\->
-            <xsl:copy-of select="$input_obj_with_xpath"/>
-        </input_obj_with_xpath_debug>-->
-        <!--<input_node_debug>
-            <xsl:copy-of select="."/>
-        </input_node_debug>-->
-        <xsl:apply-templates mode="after_first_ant_assing_vars_childs">
-            <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
-            <xsl:with-param name="xml_id_parent" select="@xml_id"/>
-            <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
-        </xsl:apply-templates>
+            <xsl:message>#354 count($wfs_output_nodes//gml:featureMember) <xsl:value-of select="count($wfs_output_nodes//gml:featureMember)"/></xsl:message>
+          <!-- tutaj jest blad przetwarzania ze wrzuca po rekordzie do kolumny - trzeba przetworzyc dla kazdego feature member -->
+            <xsl:for-each select="$wfs_output_nodes//gml:featureMember">
+                <xsl:variable name="input_obj_with_xpath">
+                    <xsl:apply-templates mode="after_first_ant_assing_xpath"/>
+                </xsl:variable>
+                <!--<input_obj_with_xpath_debug>
+                    <xsl:attribute name="xpath" select="$xpath"/>
+                    <!-\-<xsl:attribute name="xpath_dita" select="$xpath_dita"/>-\->
+                    <xsl:attribute name="xpath_value" select="$xpath_value"/>
+                    <!-\-<xsl:attribute name="xpath_value_dita" select="$xpath_value_dita"/>-\->
+                    <xsl:attribute name="typeName" select="$typeName"/>
+                    <!-\-<xsl:attribute name="typeName_dita" select="$typeName_dita"/>-\->
+                    <!-\-<xsl:attribute name="featureID_name" select="$featureID_name"/>-\->
+                    <!-\-<xsl:attribute name="featureID_name_dita" select="$featureID_name_dita"/>-\->
+                    <xsl:copy-of select="$input_obj_with_xpath"/>
+                </input_obj_with_xpath_debug>-->
+                <!--<input_node_debug>
+                    <xsl:copy-of select="."/>
+                </input_node_debug>-->
+                <xsl:apply-templates mode="after_first_ant_assing_vars_childs" select="$current_RelatedFeature">
+                    <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
+                    <xsl:with-param name="xml_id_parent" select="$xml_id"/>
+                    <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+                    <xsl:with-param name="feature_pos" select="position()"/><!-- wiecej features z relacji dokladamy pozycje -->
+                </xsl:apply-templates>
+            </xsl:for-each>
         </RelatedFeatureRoot>
     </xsl:template>
     
@@ -422,7 +429,8 @@
         <xsl:param name="input_obj_with_xpath" required="yes"/>
         <xsl:param name="xml_id_parent" required="yes"/>
         <xsl:param name="loop_xpath"  select="$loop_xpath"/>
-        <xsl:message>#411 mode after_first_ant_assing_vars_childs bylo $loop_xpath=<xsl:value-of select="$loop_xpath"/>;</xsl:message>
+        <xsl:param name="feature_pos"   required="yes"/>
+        <xsl:message>#411 $feature_pos=<xsl:value-of select="$feature_pos"/>; mode after_first_ant_assing_vars_childs bylo $loop_xpath=<xsl:value-of select="$loop_xpath"/>;</xsl:message>
         <!-- jest okazja do zrobienia bilda aby sciagnal rzeczy nizej -->
         <xsl:variable name="featureID_name" select="substring-after(@typeName,':')"/>
         <xsl:variable name="xml_id" select="@xml_id"/>
@@ -457,6 +465,7 @@
         <xsl:param name="xml_id_parent" required="yes"/>
         <xsl:param name="loop_xpath"   required="yes"/>
         <xsl:param name="input_obj_with_xpath" required="yes"/>
+        <xsl:param name="feature_pos"  required="yes"/>
         <xsl:for-each select=".">
             <xsl:choose>
                 <!--<xsl:when test="node()='topic'">asdad</xsl:when>-->
@@ -497,9 +506,9 @@
                                     </xsl:call-template>
                                 </xsl:variable>-->
                                 <xsl:variable name="enter_to_ph">
-                                    <xsl:call-template name="enter_to_ph">
-                                        <xsl:with-param name="text" select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]/text()"/>
-                                    </xsl:call-template>
+                                    <xsl:apply-templates mode="enter_to_ph" select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]">
+                                        <xsl:with-param name="count" select="count($input_obj_with_xpath/node()[local-name()=current()/@xpath])"/>
+                                    </xsl:apply-templates>
                                 </xsl:variable>
                                 <xsl:copy-of select="$enter_to_ph"/>
                             </xsl:when>
@@ -509,6 +518,7 @@
                             <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
                             <xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>
                             <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+                            <xsl:with-param name="feature_pos" select="$feature_pos"/>
                         </xsl:apply-templates>
                     </xsl:element>
                 </xsl:otherwise>
@@ -519,16 +529,30 @@
     <xsl:template match="comment()" mode="after_first_ant_assing_vars_childs"/>
     <!-- pozbieranie do kupy wszystkich xmli i zlozenie dity -->
     
-    <xsl:template name="enter_to_ph">
-        <xsl:param name="text" required="yes"/>
+    
+    
+    
+    
+    <xsl:template match="*" mode="enter_to_ph">
+        <xsl:param name="count"/>
         <xsl:choose>
-            <xsl:when test=" contains($text,'&#13;')">
-                <xsl:for-each select="tokenize($text,'&#13;')">
+            <xsl:when test=" contains(  text(),'&#13;')">
+                <xsl:for-each select="tokenize(  text(),'&#13;')">
                     <codeblock><xsl:value-of select="."/></codeblock>
                 </xsl:for-each>
             </xsl:when>
             <xsl:otherwise>
-                <xsl:copy-of select="$text"/>
+                <xsl:choose>
+                    <xsl:when test="$count &gt;1">
+                        <codeblock>
+<!--                            count:<xsl:value-of select="$count"/>
+-->                            <xsl:copy-of select=" text()"/>
+                        </codeblock>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:copy-of select=" text()"/>
+                    </xsl:otherwise>
+                </xsl:choose>
             </xsl:otherwise>
         </xsl:choose>
     </xsl:template>