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

upd fast umowa z get_wfs_recurse

a.binder 8 лет назад
Родитель
Сommit
d02d3a88b4

+ 3 - 3
SE/schema/ant-url_action/default_db.in7_dziennik_koresp/umowa/IN7_DZIENNIK_KORESP.dita

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<RelatedFeature xpath="ID"  typeName="p5_default_db:IN7_DZIENNIK_KORESP"
+<RelatedFeature xpath="ID"  typeName="p5_default_db:IN7_DZIENNIK_KORESP" typeNameRealResource="p5_default_db:IN7_DZIENNIK_KORESP"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xsi:noNamespaceSchemaLocation="../../../default_db_xml_cache.public/topicProcesy5.xsd">
   <!-- Sample template to use with Procesy5 model-driven engine with Concurrent and Parallel processing   -->
@@ -21,7 +21,7 @@
     <simpletable id="simpletable_uym_ps1_zy">
       <strow>
         <stentry>
-          <RelatedFeature xpath="ID" xpath_value="../ID_BILLING_OWNER" typeName="p5_default_db:BILLING_OWNER"><!-- oznacza to refa z w $var=ID_BILLING_OWNER jest FeatureID=BILLING_OWNER.$var do sciagniecia z p5_default_db:BILLING_OWNER -->
+          <RelatedFeature xpath="ID" xpath_value="../ID_BILLING_OWNER" typeName="p5_default_db:BILLING_OWNER" typeNameRealResource="p5_default_db:BILLING_OWNER"><!-- oznacza to refa z w $var=ID_BILLING_OWNER jest FeatureID=BILLING_OWNER.$var do sciagniecia z p5_default_db:BILLING_OWNER -->
             <p>Zleceniodawca:</p><ph/>
             <p xpath="name1"/><ph/>
             <p xpath="name2"/><ph/>
@@ -41,7 +41,7 @@
       </strow>
     </simpletable>
     
-    <p><b>Temat: <ph/><ph xpath="K_ZAWARTOS"/></b></p>
+    <p><b>Tytuł umowy: <ph/><ph xpath="K_ZAWARTOS"/></b></p>
   
  
     <p>Tresc: </p>

+ 30 - 7
SE/schema/ant-url_action/default_db.in7_dziennik_koresp/umowa/build_recurse_ant.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project basedir="." name="recurse_ant" default="buildpdf_recursed"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+<project basedir="." name="recurse_ant" default="buildpdf_recursed_xsl"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:xs="http://www.w3.org/2001/XMLSchema" >
     <description>
         Umowa 
@@ -871,24 +871,31 @@
     </target>   
     
     <target name="buildpdf_recursed_xsl" depends="install_folders,uuid_check,typeName_check,xpath_check,xpath_value_check,set_dita"  description="retrieve and build object from api using just XSL calls - needed username and password">
-        
-        
-        <echo>#836 will try to in $main_build_recurse_ant.dita_with_id ${main_build_recurse_ant.dita_with_id}</echo>
-        <xslt basedir="${default_db:recurse_ant_basedir}" style="${get_wfs_recurse_xsl.xsl}" in="${empty.xml}"  destdir="./" out="${main_build_recurse_ant.dita_with_id}" > <!-- out_task.dita.final -->
+        <echo>#836 will try to in $main_build_recurse_ant.dita_with_id ${main_build_recurse_ant.dita_with_id} , $empty.xml = ${empty.xml}</echo>
+        <echoxml file="${empty.xml}">
+            <empty>empty</empty>
+        </echoxml>
+        <xslt basedir="${default_db:recurse_ant_basedir}" style="${get_wfs_recurse_xsl.xsl}" in="${empty.xml}"  destdir="./" out="${out_task.dita.final}" > <!-- out_task.dita.final -->
             <factory name="net.sf.saxon.TransformerFactoryImpl">    
                 <!--<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>-->
                 <attribute name="http://saxon.sf.net/feature/initialTemplate" value="main"/>
             </factory>
             
-            <classpath location="/opt/local/share/java/saxon.jar"/>
-            <!--<classpath location="/opt/local/share/java/saxon9he.jar"/>-->
+            <!--<classpath location="/opt/local/share/java/saxon.jar"/>-->
+            
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
             <!--<param name="webRootUrl" expression="${webRootUrl}" />--> 
             <!--<param name="main_build_recurse_ant.dita" expression="${main_build_recurse_ant.dita}"/>-->
             <param name="uuid" expression="${uuid_tested}"/>
+            <param name="xpath" expression="${xpath}"/>
+            <param name="xpath_value" expression="${xpath_value}"/>
             <param name="username.pass" expression="${Password}"/>
+            <param name="php_session_id_ok.string" expression="${php_session_id}"/>
             <!--<param name="basedir" expression="${basedir}"/>-->
             <param name="temp" expression="${temp}"/>
             <param name="simpleSchema_dir" expression="${simpleSchema_dir}"/>
+            <param name="simpleSchema.xml" expression="${basedir}/${main_build_recurse_ant.dita}"/>
+            <param name="noRelatedFeatureRoot" expression="1"/>
         </xslt>
         
         
@@ -908,6 +915,22 @@
             <arg value="${out}"/>
         </exec>-->
         
+        
+        <exec executable="${dita.dir}" dir=".">
+            <arg value="-i"/>
+            <arg value="${out_task.dita.final}" />
+            <!-- <arg value="-t" />
+            <arg value="temp" />-->
+            <arg value="-f" />
+            <arg value="pdf"/>
+            <arg value="-o"/>
+            <arg value="${out}"/>
+        </exec>
+        <exec  executable="bash" dir="." outputproperty="out_task_file">
+            <arg value="-c"/>
+            <arg value="echo ${out_task.dita.final} |sed 's/^.*\///'"/>
+        </exec>
+        
         <echo message="OUTPUT__START"/>
         <!--<echo>
             &lt;br&gt;Wygenerowano wyjsciowy plik XML - sciagnij go &lt;a href=&quot;${webRootUrl}/${out_task.dita.final_with_RelatedFeatureLoop_no_path}.xml&quot; target=&quot;_blank&quot;&gt; &quot;${webRootUrl}/${out_task.dita.final_with_RelatedFeatureLoop_no_path}.xml&lt;/a&gt;&lt;/br&gt; 

+ 198 - 37
SE/schema/default_db_xml_cache.public/get_wfs_recurse_xsl.xsl

@@ -22,14 +22,17 @@
     <!-- TESTING for recurse get WFS using xsd schemas and/or retrieved xlinks  -->
     
     <xsl:import href="system_cache__appinfo/escape_functions.xsl"/>
+    
+    <xsl:include href="default_db/enter_to_ph.xsl"/>
+    
     <xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
     
     
     
     
-    <xsl:param name="typeName" select="'p5_default_db:PROCES_INIT'"/>
-    <xsl:param name="typeName.object" select="'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA'"/>
+    <xsl:param name="typeName" /> <!-- select="'p5_default_db:PROCES_INIT'" -->
+    <xsl:param name="typeName.object"/> <!-- select="'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA'" -->
     <xsl:param name="xpath" select="'ID'"/>
     <xsl:param name="xpath_value" select="'994'"/>
     <xsl:param name="uuid" select="'PROCES_INIT_PID_994_ALL_test'"/>
@@ -42,6 +45,7 @@
     <xsl:param name="username.pass"  required="yes"/>
     <xsl:param name="php_session_id_ok.string"/>
     <xsl:param name="simpleSchema_dir" required="yes"/>
+    <xsl:param name="simpleSchema.xml" /> <!-- Optionally force simpleSchema to build map -->
     
     <xsl:param name="targetNamespace_DEFAULTS_prefix" select="'default_db'"/> <!-- TODO should be detected -->
     <xsl:param name="debug" select="0"/>
@@ -61,7 +65,28 @@
     <xsl:param name="p5:links.recurse_level.limit" select="8"/>
     <xsl:param name="p5:links.next.recurse_level.limit" select="10"/>
     <xsl:param name="p5:links.loop.context.nodes.min.distance" select="4"/> <!-- when detected in @xlink or @next   <get_wfs_recurse_xsl:context.nodes//@fid , we calculate when it is to be treated as loop, if above $p5:links.recurse_level.limit - to be optimized   -->
-    
+    <xsl:param name="noRelatedFeatureRoot"/> 
+     
+    <!-- Plik XML z query XML <GetFeature xmlns="http://www.opengis.net/wfs/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ogc="http://www.opengis.net/ogc"  xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="2.0.2"><wfs:Query>
+        <wfs:PropertyName>ID</wfs:PropertyName>
+        <wfs:PropertyName>PARENT_ID</wfs:PropertyName>
+        <wfs:PropertyName>TYPE</wfs:PropertyName>
+        <wfs:PropertyName>DESC</wfs:PropertyName>
+        <wfs:PropertyName resolve="all" resolveDepth="2">default_db__x3A__CRM_LISTA_ZASOBOW:CRM_LISTA_ZASOBOW</wfs:PropertyName>
+        <ogc:Filter>
+                <ogc:Or>
+                        <ogc:PropertyIsEqualTo>
+                                <ogc:PropertyName>ID</ogc:PropertyName>
+                                <ogc:Literal>1003</ogc:Literal>
+                        </ogc:PropertyIsEqualTo>
+                        <ogc:PropertyIsEqualTo>
+                                <ogc:PropertyName>ID</ogc:PropertyName>
+                                <ogc:Literal>608</ogc:Literal>
+                        </ogc:PropertyIsEqualTo>
+                </ogc:Or>
+        </ogc:Filter>
+</wfs:Query></GetFeature>
+ -->
     
     
     <xsl:function name="get_wfs_recurse_xsl:GetsimpleSchema">
@@ -103,17 +128,28 @@
             <xsl:when test="$api_recurse">
                 <!-- default_db:CRM_LISTA_ZASOBOW -->
                 <xsl:choose>
-                    <xsl:when test="$typeName.object">
+                    <xsl:when test="string-length($typeName.object) &gt; 0">
+                        <xsl:message>#128-A set $typeName.object = <xsl:value-of select="$typeName.object"/></xsl:message>
                         <xsl:value-of select="$typeName.object"/>
                     </xsl:when>
                     <xsl:otherwise>
+                        <xsl:message>#128-A set $typeName.local = <xsl:value-of select="$get_wfs_recurse_xsl:GetsimpleSchema/RelatedFeature/@typeName"/></xsl:message>
                         <xsl:variable name="typeName.local" select="$get_wfs_recurse_xsl:GetsimpleSchema/RelatedFeature/@typeName"/>
                         <xsl:value-of select="concat( system_cache__appinfo:escape_object_prefix_to_string($typeName),':', system_cache__appinfo:clean_object_prefix($typeName))"/>
+                        <xsl:message>#128-A-2 set result get_wfs_recurse_xsl:typeNameRealResource = <xsl:value-of select="concat( system_cache__appinfo:escape_object_prefix_to_string($typeName),':', system_cache__appinfo:clean_object_prefix($typeName))"/></xsl:message>
                     </xsl:otherwise>
                 </xsl:choose>
             </xsl:when>
             <xsl:otherwise>
-                <xsl:value-of select="$get_wfs_recurse_xsl:GetsimpleSchema/RelatedFeature/@typeNameRealResource"/>
+                <xsl:choose>
+                    <xsl:when test="$get_wfs_recurse_xsl:GetsimpleSchema/RelatedFeature/@typeNameRealResource">
+                        <xsl:value-of select="$get_wfs_recurse_xsl:GetsimpleSchema/RelatedFeature/@typeNameRealResource"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:message terminate="yes">#145 SET $get_wfs_recurse_xsl:GetsimpleSchema/RelatedFeature/@typeNameRealResource param!</xsl:message>
+                    </xsl:otherwise>
+                </xsl:choose>
+                
             </xsl:otherwise>
         </xsl:choose>
         
@@ -343,10 +379,12 @@
       <!--  <xsl:param name="get_wfs_recurse_xsl:xpath_dita" required="yes"/>
         <xsl:param name="get_wfs_recurse_xsl:xpath_value_dita" required="yes"/>-->
         <xsl:param name="RelatedFilter"/>
+        
         <xsl:if test="$debug &gt; 2"><xsl:message>#1754 name="simpleTypeMakeOgcFilter_merge"
             $simpleTypeMakeOgcFilter = <xsl:copy-of select="$simpleTypeMakeOgcFilter"></xsl:copy-of>
             $get_wfs_recurse_xsl:xpath_dita = <xsl:copy-of select="$xpath_dita"/>
             $get_wfs_recurse_xsl:xpath_value_dita = <xsl:copy-of select="$xpath_value_dita"/>
+            
             #EOF
         </xsl:message>
         </xsl:if>
@@ -402,13 +440,35 @@
         <xsl:param name="targetNamespace_DEFAULTS_prefix" select="$targetNamespace_DEFAULTS_prefix"/>
         <!--<xsl:param name="xpath_value" select="$xpath_value"/>-->
         <xsl:param name="get_wfs_recurse_xsl:xpath"/>
-        <xsl:message>#255 typeName = <xsl:value-of select="$typeName"/></xsl:message>
-        <RelatedFeatureRoot>
+        <xsl:message>#255 $typeName = <xsl:value-of select="$typeName"/>; $typeName.object = <xsl:value-of select="$typeName.object"/> </xsl:message>
+        <!--<RelatedFeatureRoot>-->
             <!--<xsl:namespace name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA" select="'https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA'"/>-->
              <xsl:variable name="input_obj_with_xpath"><input_obj_with_xpath/></xsl:variable>
-             <xsl:variable name="get_wfs_recurse_xsl:GetsimpleSchema" select="get_wfs_recurse_xsl:GetsimpleSchema($typeName)"/>
+             <xsl:variable name="get_wfs_recurse_xsl:GetsimpleSchema" >
+                 <xsl:choose>
+                     <xsl:when test=" string-length($simpleSchema.xml) &gt; 1">
+                         <xsl:message>#435 USING doc($simpleSchema.xml) </xsl:message>
+                         <xsl:copy-of select="doc($simpleSchema.xml)"/>
+                     </xsl:when>
+                     <xsl:when test=" string-length($typeName.object) &gt; 1"/>
+                     <xsl:otherwise><!-- todo copy of or value of ?  -->
+                         <xsl:copy-of select="get_wfs_recurse_xsl:GetsimpleSchema($typeName)"/>
+                     </xsl:otherwise>
+                 </xsl:choose>
+             </xsl:variable>
              <!--<xsl:copy-of select="$get_wfs_recurse_xsl:GetsimpleSchema"/>-->
-             <xsl:variable name="get_wfs_recurse_xsl:typeNameRealResource" select="get_wfs_recurse_xsl:typeNameRealResource($get_wfs_recurse_xsl:GetsimpleSchema)"/>
+             <xsl:variable name="get_wfs_recurse_xsl:typeNameRealResource" >
+                 <xsl:choose>
+                     <xsl:when test=" string-length($typeName.object) &gt; 1">
+                         <xsl:message>#448-B  USING $typeName.object as get_wfs_recurse_xsl:typeNameRealResource </xsl:message>
+                         <xsl:value-of select="$typeName.object"/>
+                     </xsl:when>
+                     <xsl:otherwise>
+                         <xsl:message>#448-C  USING get_wfs_recurse_xsl:typeNameRealResource($get_wfs_recurse_xsl:GetsimpleSchema) to detect get_wfs_recurse_xsl:typeNameRealResource = detected=<xsl:value-of select="get_wfs_recurse_xsl:typeNameRealResource($get_wfs_recurse_xsl:GetsimpleSchema)"/> , from get_wfs_recurse_xsl:GetsimpleSchema = <xsl:value-of select="$get_wfs_recurse_xsl:GetsimpleSchema"/></xsl:message>
+                         <xsl:value-of select="get_wfs_recurse_xsl:typeNameRealResource($get_wfs_recurse_xsl:GetsimpleSchema)"/>
+                     </xsl:otherwise>
+                 </xsl:choose>
+             </xsl:variable>
              
              <xsl:variable name="xpath_dita" select="$xpath"/>
              <xsl:variable name="xpath_value_dita" select="$xpath_value"/>
@@ -419,9 +479,9 @@
                  <xsl:call-template name="simpleTypeMakeOgcFilter_merge">
                      <xsl:with-param name="simpleTypeMakeOgcFilter" select="$get_wfs_recurse_xsl:simpleTypeMakeOgcFilter"/>
                      <xsl:with-param name="RelatedFilter" select="$get_wfs_recurse_xsl:RelatedFilter"/>
-                     
                      <xsl:with-param name="xpath_dita" select="$xpath"/>
                      <xsl:with-param name="xpath_value_dita" select="$xpath_value"/>
+                     <!--<xsl:with-param name="Query.xml.local" select="$Query.xml.local"/>--><!-- Conditionally force query based on XML -->
                      <!--<xsl:with-param name="get_wfs_recurse_xsl:xpath_dita" select="$xpath"/>-->
                      <!--<xsl:with-param name="get_wfs_recurse_xsl:xpath_value_dita" select="$xpath_value"/>-->
                  </xsl:call-template>
@@ -487,43 +547,89 @@
                  <xsl:copy-of select="$get_wfs_recurse_xsl:context.nodes"/>
             </xsl:if>
             <xsl:choose>
-            <xsl:when test="$api_recurse">
-                <xsl:if test="$get_wfs_recurse_xsl:wfs_response/ServiceExceptionReport" xpath-default-namespace="http://www.opengis.net/ogc">
-                    <xsl:message terminate="yes"> Error with query <xsl:value-of select="$get_wfs_recurse_xsl:wfs_response//ServiceException/text()" xpath-default-namespace="http://www.opengis.net/ogc"/></xsl:message>
-                </xsl:if>
+                <xsl:when test=" string-length($api_recurse) &gt; 0">
+                    <xsl:if test="$get_wfs_recurse_xsl:wfs_response/ServiceExceptionReport" xpath-default-namespace="http://www.opengis.net/ogc">
+                        <xsl:message terminate="yes">ServiceException!  Error with query <xsl:value-of select="$get_wfs_recurse_xsl:wfs_response//ServiceException/text()" xpath-default-namespace="http://www.opengis.net/ogc"/></xsl:message>
+                    </xsl:if>
+                    <xsl:choose>
+                        <xsl:when test="$get_wfs_recurse_xsl:wfs_response//p5:next">
+                            <xsl:message> #360 to parse to retrieve links and merge xml <xsl:value-of select="$get_wfs_recurse_xsl:wfs_response//p5:next/text()"/></xsl:message>
+                            <!--<xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/namespace::node()"/> <!-\- [ not(contains(  local-name(),'wfs'))] -\->
+                            <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember/namespace::node()"/>
+                            <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember/*/namespace::node()"/>
+                            <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember//*/namespace::node()"/>-->
+                            <xsl:choose>
+                                <xsl:when test="$noRelatedFeatureRoot">
+                                    <xsl:apply-templates mode="p5:links.evaluate" select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember/*" xpath-default-namespace="http://www.opengis.net/wfs">
+                                        <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:context.nodes"/>
+                                        <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
+                                        <xsl:with-param name="debug.last_wfs_request" select="$request_string"/>
+                                    </xsl:apply-templates>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <RelatedFeatureRoot>
+                                        <xsl:apply-templates mode="p5:links.evaluate" select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember/*" xpath-default-namespace="http://www.opengis.net/wfs">
+                                            <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:context.nodes"/>
+                                            <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
+                                            <xsl:with-param name="debug.last_wfs_request" select="$request_string"/>
+                                        </xsl:apply-templates>
+                                    </RelatedFeatureRoot>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                            
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:choose>
+                                <xsl:when test="$noRelatedFeatureRoot">
+                                    <xsl:if test="$debug &gt; 3"><xsl:message>#533 going after wfs:FeatureCollection/gml:featureMember/*...</xsl:message></xsl:if>
+                                    <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember/*"/>
+                                    <xsl:apply-templates mode="p5:links.evaluate" select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember/*" xpath-default-namespace="http://www.opengis.net/wfs">
+                                        <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:context.nodes"/>
+                                        <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
+                                        <xsl:with-param name="debug.last_wfs_request" select="$request_string"/>
+                                    </xsl:apply-templates>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <RelatedFeatureRoot>
+                                         <xsl:if test="$debug &gt; 3"><xsl:message>#533 going after wfs:FeatureCollection/gml:featureMember/*...</xsl:message></xsl:if>
+                                         <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember/*"/>
+                                         <xsl:apply-templates mode="p5:links.evaluate" select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember/*" xpath-default-namespace="http://www.opengis.net/wfs">
+                                             <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:context.nodes"/>
+                                             <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
+                                             <xsl:with-param name="debug.last_wfs_request" select="$request_string"/>
+                                         </xsl:apply-templates>
+                                    </RelatedFeatureRoot>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:when>
+            <xsl:otherwise>
+                <xsl:message>#563 applying root without $api_recurse. </xsl:message>
                 <xsl:choose>
-                    <xsl:when test="$get_wfs_recurse_xsl:wfs_response//p5:next">
-                        <xsl:message> #360 to parse to retrieve links and merge xml <xsl:value-of select="$get_wfs_recurse_xsl:wfs_response//p5:next/text()"/></xsl:message>
-                        <!--<xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/namespace::node()"/> <!-\- [ not(contains(  local-name(),'wfs'))] -\->
-                        <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember/namespace::node()"/>
-                        <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember/*/namespace::node()"/>
-                        <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember//*/namespace::node()"/>-->
-                        <xsl:apply-templates mode="p5:links.evaluate" select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember/*" xpath-default-namespace="http://www.opengis.net/wfs">
+                    <xsl:when test="$noRelatedFeatureRoot">
+                        <xsl:apply-templates mode="after_first_ant_assing_vars" select="$get_wfs_recurse_xsl:GetsimpleSchema">
+                            <xsl:with-param name="get_wfs_recurse_xsl:wfs_response" select="$get_wfs_recurse_xsl:wfs_response"/>
                             <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:context.nodes"/>
                             <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
                             <xsl:with-param name="debug.last_wfs_request" select="$request_string"/>
                         </xsl:apply-templates>
                     </xsl:when>
                     <xsl:otherwise>
-                        <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember/*"/>
-                        <xsl:apply-templates mode="p5:links.evaluate" select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember/*" xpath-default-namespace="http://www.opengis.net/wfs">
-                            <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:context.nodes"/>
-                            <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
-                            <xsl:with-param name="debug.last_wfs_request" select="$request_string"/>
-                        </xsl:apply-templates>
+                        <RelatedFeatureRoot>
+                            <xsl:apply-templates mode="after_first_ant_assing_vars" select="$get_wfs_recurse_xsl:GetsimpleSchema">
+                                <xsl:with-param name="get_wfs_recurse_xsl:wfs_response" select="$get_wfs_recurse_xsl:wfs_response"/>
+                                <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:context.nodes"/>
+                                <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
+                                <xsl:with-param name="debug.last_wfs_request" select="$request_string"/>
+                            </xsl:apply-templates>
+                        </RelatedFeatureRoot>
                     </xsl:otherwise>
                 </xsl:choose>
-            </xsl:when>
-            <xsl:otherwise>
-                <xsl:apply-templates mode="after_first_ant_assing_vars" select="$get_wfs_recurse_xsl:GetsimpleSchema">
-                    <xsl:with-param name="get_wfs_recurse_xsl:wfs_response" select="$get_wfs_recurse_xsl:wfs_response"/>
-                    <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:context.nodes"/>
-                    <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
-                    <xsl:with-param name="debug.last_wfs_request" select="$request_string"/>
-                </xsl:apply-templates>
+                
             </xsl:otherwise>
         </xsl:choose>
-        </RelatedFeatureRoot>
+        <!--</RelatedFeatureRoot>-->
     </xsl:template>
     
     
@@ -1122,6 +1228,11 @@
         <!--<xsl:variable name="input_obj_with_xpath">
             <xsl:apply-templates mode="after_first_ant_assing_xpath" select="node()/*"/> <!-\- zeby nie wstawial do xpath nazwy feature - IN7_DZIENNIK_KORESP/ID itp -\->
         </xsl:variable>-->
+        <xsl:choose>
+            <xsl:when test="@typeNameRealResource"/>
+            <xsl:otherwise><xsl:message terminate="yes">#1174 NOT SET @typeNameRealResource at <xsl:value-of select="name()"/>; </xsl:message></xsl:otherwise>
+        </xsl:choose>
+        <xsl:if test="$debug &gt; 4"><xsl:message>#1172 @typeNameRealResource = <xsl:value-of select="@typeNameRealResource"/> = Set to $get_wfs_recurse_xsl:typeNameRealResource</xsl:message></xsl:if>
         <xsl:variable name="xpath_dita" select="get_wfs_recurse_xsl:xpath_dita('',@xpath)"/>
         <xsl:variable name="xpath_value_dita" select="get_wfs_recurse_xsl:xpath_value_dita(@xpath,@xpath_value,$input_obj_with_xpath)"/>
         <!--<xsl:variable name="get_wfs_recurse_xsl:GetsimpleSchema" select="get_wfs_recurse_xsl:GetsimpleSchema($typeName)"/>-->
@@ -1401,6 +1512,7 @@
                             <xsl:choose>
                                 <xsl:when test="name()='fid'"/>
                                 <xsl:when test="name()='xml_id'"/>
+                                <xsl:when test="name()='format'"/>
                                 <xsl:when test="name()='xpath'">
                                     <!--<xsl:attribute name="xpath_parsed" select="."/>-->
                                     <!--1:<xsl:value-of select="$parent_obj//node()[@system_cache__appinfo:xpath=$xpath]/text()"/>-->
@@ -1426,7 +1538,56 @@
                                             <xsl:copy-of select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]/*"/>
                                         </xsl:when>
                                         <xsl:otherwise>
-                                            <xsl:copy-of select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]/text()"/>
+                                            <xsl:choose>
+                                                <!--TODO <xsl:when test="@format = 'enter_to_ph'">
+                                                    <xsl:variable name="node">
+                                                        <xsl:element name="{name()}">
+                                                            <xsl:copy-of select="."/>
+                                                        </xsl:element>
+                                                    </xsl:variable>
+                                                    <xsl:variable name="enter_to_ph">
+                                                        <xsl:apply-templates mode="enter_to_ph" select="$node">
+                                                            <xsl:with-param name="count" select="count(.)"/>
+                                                            <xsl:with-param name="element" select="name()"/>
+                                                            <!-\-<xsl:with-param name="xpath_token_filter" select="@xpath_token_filter"/>-\-><!-\- mozliwosc wybrania pierwszego wyrazu np ' ' -\->
+                                                            <!-\-<xsl:with-param name="xpath_token" select="@xpath_token"/>-\-><!-\- mozliwosc wybrania pierwszego wyrazu np 1 -\->
+                                                        </xsl:apply-templates>
+                                                    </xsl:variable>
+                                                    <formated>
+                                                        <node>
+                                                            <xsl:copy-of select="$node"/>
+                                                        </node>
+                                                        <xsl:copy-of select="$enter_to_ph" copy-namespaces="no"/>
+                                                    </formated>
+                                                </xsl:when>-->
+                                                <xsl:when test="@format = 'enter_to_ph'">
+                                                    <xsl:variable name="node">
+                                                        <xsl:element name="{name()}">
+                                                            <xsl:copy-of select="."/>
+                                                        </xsl:element>
+                                                    </xsl:variable>
+                                                    <xsl:variable name="node-name" select="local-name()"/>
+                                                    <xsl:variable name="node-count" select="count(../*[ local-name() = $node-name])"/>
+                                                    <xsl:message>#1562 TODO @format = 'enter_to_ph' ; element=<xsl:value-of select="name()"/>; count()=<xsl:value-of select="$node-count"/> ;   </xsl:message>
+                                                    <xsl:variable name="node-set">
+                                                        <xsl:element name="{$node-name}">
+                                                            <xsl:copy-of select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]/text()"/>
+                                                        </xsl:element>
+                                                    </xsl:variable>
+                                                    <xsl:variable name="enter_to_ph">
+                                                        <xsl:apply-templates mode="enter_to_ph" select="$node-set">
+                                                            <xsl:with-param name="count" select="$node-count"/>
+                                                            <xsl:with-param name="element" select="$node-name"/>
+                                                            <!--<xsl:with-param name="xpath_token_filter" select="@xpath_token_filter"/>--><!-- mozliwosc wybrania pierwszego wyrazu np ' ' -->
+                                                            <!--<xsl:with-param name="xpath_token" select="@xpath_token"/>--><!-- mozliwosc wybrania pierwszego wyrazu np 1 -->
+                                                        </xsl:apply-templates>
+                                                    </xsl:variable>
+                                                        <xsl:copy-of select="$enter_to_ph" copy-namespaces="no"/>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                    <xsl:copy-of select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]/text()"/>
+                                                </xsl:otherwise>
+                                            </xsl:choose>
                                         </xsl:otherwise>
                                     </xsl:choose>
                                 <!--</xsl:variable>-->