a.binder 6 jaren geleden
bovenliggende
commit
b3f177fc45
1 gewijzigde bestanden met toevoegingen van 4 en 1832 verwijderingen
  1. 4 1832
      SE/schema/default_db_xml_cache.public/get_wfs_recurse_xsl.xsl

+ 4 - 1832
SE/schema/default_db_xml_cache.public/get_wfs_recurse_xsl.xsl

@@ -21,9 +21,11 @@
     
     <!-- TESTING for recurse get WFS using xsd schemas and/or retrieved xlinks  -->
     
-    <xsl:import href="system_cache__appinfo/escape_functions.xsl"/>
+    <!--<xsl:import href="system_cache__appinfo/escape_functions.xsl"/>
     
-    <xsl:include href="default_db/enter_to_ph.xsl"/>
+    <xsl:include href="default_db/enter_to_ph.xsl"/>-->
+    
+    <xsl:include href="../WPS_Functions/get_wfs_recurse_xsl/get_wfs_recurse_xsl.xsl"/>
     
     <xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
@@ -31,1836 +33,6 @@
     
     
     
-    <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'"/>
-    <xsl:param name="MAXFEATURES" select="1000"/>
-    
-    <!--<xsl:param name="procesy5_system_schema_file" required="yes"/>-->
-    <!--<xsl:param name="vrtfNamespaces_file" required="yes"/>-->
-    
-    <xsl:param name="username" select="'a.binder'"/>
-    <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"/>
-    
-    
-    <xsl:param name="api" select="'biuro.biall-net.pl/SE/version-git/wfs-data.php'"/>
-    <xsl:param name="protocol" select="'https://'"/>
-    
-    <!--<xsl:variable name="vrtfNamespaces" select="doc($vrtfNamespaces_file)"/>
-    <xsl:variable name="procesy5_system_schema" select="doc($procesy5_system_schema_file)"/>
-    -->
-    
-    <xsl:param name="ignore_maxOccurs_0" select="'1'"/>
-    
-    <xsl:param name="api_recurse"/> <!-- to use api resolveDepth -->
-    <xsl:param name="resolveDepth" select="5"/>
-    <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">
-        <xsl:param name="typeNameRealResource"/>
-        
-        <xsl:variable name="featureID_name_dita">
-            <xsl:choose>
-                <xsl:when test=" substring-before(system_cache__appinfo:translate_object_escaped_prefix_from_string(substring-before($typeNameRealResource,':')),':')">
-                    <xsl:value-of select="$typeNameRealResource"/>
-                </xsl:when>
-                <xsl:when test=" substring-after($typeNameRealResource,':')">
-                    <xsl:value-of select="substring-after($typeNameRealResource,':')"/>
-                </xsl:when>
-                <xsl:otherwise><xsl:value-of select="$typeNameRealResource"/></xsl:otherwise>
-            </xsl:choose>
-        </xsl:variable>
-        
-        <xsl:variable name="simpleSchemaFile">
-            <xsl:choose>
-                <xsl:when test=" substring-before(system_cache__appinfo:translate_object_escaped_prefix_from_string(substring-before($typeNameRealResource,':')),':')">
-                    <xsl:message>#74 this is object not simpleType element - selecting  simpleSchema to <xsl:value-of select="concat($simpleSchema_dir,'/',substring-before(system_cache__appinfo:translate_object_escaped_prefix_from_string(substring-before($typeNameRealResource,':')),':'),'/',substring-after($typeNameRealResource,':'),'.xml')"/></xsl:message>
-                    <xsl:value-of select="concat($simpleSchema_dir,'/',substring-before(system_cache__appinfo:translate_object_escaped_prefix_from_string(substring-before($typeNameRealResource,':')),':'),'/',substring-after($typeNameRealResource,':'),'.xml')"/>
-                </xsl:when>
-                <xsl:otherwise><xsl:value-of select="concat($simpleSchema_dir,'/',$targetNamespace_DEFAULTS_prefix,'/',$featureID_name_dita,'.xml')"/></xsl:otherwise>
-            </xsl:choose>
-        </xsl:variable>
-        <xsl:message>#57 get_wfs_recurse_xsl:GetsimpleSchema:  from $typeNameRealResource=<xsl:value-of select="$typeNameRealResource"/>; <xsl:value-of select="$simpleSchemaFile"/>  for featureID_name_dita=<xsl:value-of select="$featureID_name_dita"/>;</xsl:message>
-        
-        
-        <xsl:if test="not( substring-before(system_cache__appinfo:translate_object_escaped_prefix_from_string(substring-before($typeNameRealResource,':')),':'))">
-            <xsl:copy-of select="doc($simpleSchemaFile)"/>
-        </xsl:if>
-        
-    </xsl:function>
-    
-    <xsl:function name="get_wfs_recurse_xsl:typeNameRealResource">
-        <xsl:param name="get_wfs_recurse_xsl:GetsimpleSchema"/>
-        <xsl:choose>
-            <xsl:when test="$api_recurse">
-                <!-- default_db:CRM_LISTA_ZASOBOW -->
-                <xsl:choose>
-                    <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:choose>
-                    <xsl:when test="$get_wfs_recurse_xsl:GetsimpleSchema/(RelatedFeature|RelatedFeatureRoot)/@typeNameRealResource">
-                        <xsl:value-of select="$get_wfs_recurse_xsl:GetsimpleSchema/(RelatedFeature|RelatedFeatureRoot)/@typeNameRealResource"/>
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <xsl:message terminate="yes">#145 SET $get_wfs_recurse_xsl:GetsimpleSchema/RelatedFeature/@typeNameRealResource param!
-                            in file <xsl:value-of select="$simpleSchema.xml"/>
-                            <xsl:copy-of select="$get_wfs_recurse_xsl:GetsimpleSchema"/>
-                        </xsl:message>
-                    </xsl:otherwise>
-                </xsl:choose>
-                
-            </xsl:otherwise>
-        </xsl:choose>
-        
-    </xsl:function>
-    <xsl:function name="get_wfs_recurse_xsl:RelatedFilter">
-        <xsl:param name="get_wfs_recurse_xsl:GetsimpleSchema"/>
-        <xsl:value-of select="$get_wfs_recurse_xsl:GetsimpleSchema/(RelatedFeatureRoot|RelatedFeature)/RelatedFilter"/>
-    </xsl:function>
-    
-    <xsl:template name="get_wfs_recurse_xsl:request_string">
-        <xsl:param name="protocol" select="$protocol"/>
-        <xsl:param name="api" select="$api"/>
-        <xsl:param name="targetNamespace_DEFAULTS_prefix" select="$targetNamespace_DEFAULTS_prefix"/>
-        <xsl:param name="username" select="$username"/>
-        <xsl:param name="username.pass" select="$username.pass"/>
-        <xsl:param name="REQUEST.SERVICE" select="'WFS'"/>
-        <xsl:param name="REQUEST.VERSION" select="'1.0.0'"/>
-        <xsl:param name="REQUEST.TYPE" select="'GetFeature'"/>
-        <xsl:param name="REQUEST.MAXFEATURES" />
-        <xsl:param name="REQUEST.TYPENAME"  required="yes"/>
-        <xsl:param name="OGC_Filter"/>
-        <xsl:param name="REQUEST.SRSNAME" select="'EPSG:3003'"/>
-        <xsl:variable name="php_session_id_ok.string">
-            <xsl:if test=" string-length($php_session_id_ok.string) &gt; 0">
-                <xsl:value-of select="concat('&amp;sid=',normalize-space($php_session_id_ok.string))"/>
-            </xsl:if>
-        </xsl:variable>
-        <xsl:variable name="api_recurse.request">
-            <xsl:choose>
-                <xsl:when test="$api_recurse">
-                    <xsl:value-of select="concat('&amp;resolveDepth=',$resolveDepth,'&amp;resolve=all')"/>
-                </xsl:when>
-            </xsl:choose>
-        </xsl:variable>
-        <xsl:variable name="username_and_pass">
-            <xsl:choose>
-                <xsl:when test="string-length($php_session_id_ok.string) &gt; 0"/>
-                <xsl:otherwise><xsl:value-of select="concat($username,':',$username.pass,'@')"/></xsl:otherwise>
-            </xsl:choose>
-        </xsl:variable>
-        <xsl:variable name="REQUEST.MAXFEATURES">
-            <xsl:choose>
-                <xsl:when test=" string-length($REQUEST.MAXFEATURES) &gt; 0">
-                    <xsl:value-of select="concat('&amp;MAXFEATURES=',$REQUEST.MAXFEATURES)"/>
-                </xsl:when>
-            </xsl:choose>
-        </xsl:variable>
-        <xsl:if test="number($debug) &gt; 0"><xsl:message>#76 req:<xsl:value-of select="$REQUEST.TYPENAME"/> filter <xsl:value-of select="$OGC_Filter//ogc:PropertyName/text()"/>/<xsl:value-of select="$OGC_Filter//ogc:Literal/text()"/></xsl:message></xsl:if>
-        <xsl:value-of select="concat($protocol,$username_and_pass,$api,'/',$targetNamespace_DEFAULTS_prefix,'/?SERVICE=',$REQUEST.SERVICE,'&amp;VERSION=',$REQUEST.VERSION,'&amp;REQUEST=',$REQUEST.TYPE,'&amp;TYPENAME=',$REQUEST.TYPENAME,$php_session_id_ok.string,$api_recurse.request,$OGC_Filter,'&amp;SRSNAME=',$REQUEST.SRSNAME)"/>
-    </xsl:template>
-    
-    
-    
-    
-    <xsl:template match="*" mode="get_wfs_recurse_xsl:context.nodes">
-        <xsl:for-each select=".//*[@fid]">
-            <get_wfs_recurse_xsl:nodes fid="{@fid}" root.distance="{count( ancestor::node())}"/>
-        </xsl:for-each>
-    </xsl:template>
-    
-    
-    <xsl:function name="get_wfs_recurse_xsl:context.PRIMARYKEY.merge">
-        <xsl:param name="get_wfs_recurse_xsl:PRIMARYKEY.nodes"/>
-        <xsl:param name="p5:fid"/>
-        <xsl:choose>
-            <xsl:when test=" string-length($p5:fid) &gt;0">
-                <get_wfs_recurse_xsl:context.nodes>
-                    <xsl:copy-of select="$get_wfs_recurse_xsl:PRIMARYKEY.nodes/get_wfs_recurse_xsl:PRIMARYKEY.nodes/*"/>
-                    <get_wfs_recurse_xsl:nodes fid="{$p5:fid}"/>
-                </get_wfs_recurse_xsl:context.nodes>
-            </xsl:when>
-            <xsl:otherwise>
-                <xsl:copy-of select="$get_wfs_recurse_xsl:PRIMARYKEY.nodes"/>
-            </xsl:otherwise>
-        </xsl:choose>
-    </xsl:function>
-    
-    
-    <xsl:function name="get_wfs_recurse_xsl:context.nodes.merge">
-        <xsl:param name="get_wfs_recurse_xsl:context.nodes"/>
-        <xsl:param name="current.node"/>
-        <get_wfs_recurse_xsl:context.nodes>
-            <xsl:copy-of select="$get_wfs_recurse_xsl:context.nodes/get_wfs_recurse_xsl:context.nodes/*"/>
-            <xsl:for-each select="$current.node//*[@fid]">
-                <get_wfs_recurse_xsl:nodes fid="{@fid}" root.distance="{count( ancestor::node())}" added="by_merge"/>
-            </xsl:for-each>
-        </get_wfs_recurse_xsl:context.nodes>
-    </xsl:function>
-        
-    <xsl:function name="get_wfs_recurse_xsl:simpleTypeMakeOgcFilter">
-        <xsl:param name="get_wfs_recurse_xsl:GetsimpleSchema"/>
-        <xsl:copy-of select="$get_wfs_recurse_xsl:GetsimpleSchema/RelatedFeature/simpleTypeMakeOgcFilter"/>
-    </xsl:function>
-    
-    <xsl:function name="get_wfs_recurse_xsl:xpath_dita">
-        <xsl:param name="xpath"/>
-        <xsl:param name="get_wfs_recurse_xsl:xpath"/>
-        <xsl:choose>
-            <xsl:when test=" string-length($get_wfs_recurse_xsl:xpath) &gt;0">
-                <xsl:value-of select="$get_wfs_recurse_xsl:xpath"/>
-                <xsl:if test="number($debug) &gt; 2"><xsl:message>#121 narzucam $xpath=(<xsl:value-of select="$get_wfs_recurse_xsl:xpath"/>) z wyzwolenia build.xml </xsl:message></xsl:if>
-            </xsl:when>
-            <xsl:otherwise><xsl:value-of select="$xpath"/></xsl:otherwise>
-        </xsl:choose>
-    </xsl:function>
-    
-    <xsl:function name="get_wfs_recurse_xsl:xpath_value_dita">
-        <xsl:param name="xpath"/>
-        <xsl:param name="xpath_value"/>
-        <!--<xsl:param name="get_wfs_recurse_xsl:xpath_value"/>-->
-        <xsl:param name="input_obj_with_xpath"/>
-        
-        <xsl:variable name="get_wfs_recurse_xsl:xpath_value_dita">
-            <xsl:choose>
-                <xsl:when test="$xpath_value">
-                    <!--<xsl:variable name="xpath_value_tokens" select="tokenize(@xpath_value,'/')"/>-->
-                    <!--<xsl:value-of select="'todo zapytanie xpath do przetworzenia'"/>-->
-                    <!--<xsl:copy-of select="$xpath_value_tokens"></xsl:copy-of>-->
-                    <!--<xsl:message>#67 probuje ustalic dla featureID_name=<xsl:value-of select="$featureID_name"/>; wartosc z @xpath_value=<xsl:value-of select="@xpath_value"/>; $input_obj_with_xpath/node()[@xpath="ID_BILLING_OWNER"] =<xsl:value-of select="$input_obj_with_xpath/node()[@xpath='ID_BILLING_OWNER']"/>; </xsl:message>-->
-                    <!--<xsl:if test="number($debug) &gt; 2"><xsl:message>#67.1 $input_obj_with_xpath: <xsl:copy-of select="$input_obj_with_xpath"/> </xsl:message></xsl:if>-->
-                    <!--<xsl:variable name="xpath_value_token">-->
-                    <xsl:call-template name="xpath_filter_apply">
-                        <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
-                        <xsl:with-param name="xpath" select="$xpath"/>
-                        <xsl:with-param name="xpath_value" select="$xpath_value"/>
-                    </xsl:call-template>
-                    <!--</xsl:variable>-->
-                    <!--<xsl:message>#73 ustalam na <xsl:value-of select="$xpath_value_token/node()[1]/text()"/>;</xsl:message>-->
-                    <!--<xsl:value-of select="$xpath_value_token/node()[1]/text()"/>-->
-                    <!--<xsl:value-of select="$xpath_value_token"/>-->
-                </xsl:when>
-                <!--<xsl:when test="string-length($get_wfs_recurse_xsl:xpath_value) &gt;0">
-                    <xsl:if test="number($debug) &gt; 2"><xsl:message>#67.0 $xpath_value=(<xsl:value-of select="$get_wfs_recurse_xsl:xpath_value"/>); narzucone pewnie z wyzwolenia build.xml</xsl:message></xsl:if>
-                    <xsl:value-of select="$get_wfs_recurse_xsl:xpath_value"/>
-                </xsl:when>
-                <xsl:otherwise>
-                    <xsl:value-of select="$get_wfs_recurse_xsl:xpath_value"/><!-\- parametr z template narzuca wartosc -\->
-                </xsl:otherwise>-->
-            </xsl:choose>
-        </xsl:variable>
-        <xsl:copy-of select="$get_wfs_recurse_xsl:xpath_value_dita"/>
-    </xsl:function>
-    
-    <xsl:template match="And" mode="simpleTypeMakeOgcFilter_merge_apply">
-        <xsl:choose>
-            <xsl:when test="child::node()">
-                <xsl:value-of select="'&lt;ogc:And&gt;'"/>
-                <xsl:apply-templates mode="simpleTypeMakeOgcFilter_merge_apply"/>
-                <xsl:value-of select="'&lt;/ogc:And&gt;'"/>
-            </xsl:when>
-        </xsl:choose>
-    </xsl:template>
-    <xsl:template match="*" mode="simpleTypeMakeOgcFilter_merge_apply" xpath-default-namespace="http://www.opengis.net/ogc">
-        <xsl:value-of select="concat('&lt;',name(),'&gt;')"/>
-        <xsl:apply-templates mode="simpleTypeMakeOgcFilter_merge_apply"/>
-        <xsl:value-of select="concat('&lt;/',name(),'&gt;')"/>
-    </xsl:template>
-    
-    <xsl:template match="text()" mode="simpleTypeMakeOgcFilter_merge_apply">
-        <xsl:value-of select="."/>
-    </xsl:template>
-    
-    <xsl:function name="p5:get_get_from_url">
-        <xsl:param name="p5:url"/> <!-- https://biuro.biall-net.pl/SE/version-git/wfs-data.php?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=d -->
-        <xsl:param name="get"/><!-- which param from get - maybe REQUEST  -->
-        <xsl:choose>
-            <xsl:when test="contains($p5:url,'?')">
-                <xsl:variable name="result">
-                    <xsl:for-each select="tokenize( substring-after($p5:url,'?'),'&amp;')">
-                        <xsl:if test="substring-before(.,'=') = $get"><xsl:value-of select="substring-after(.,'=')"/></xsl:if>
-                    </xsl:for-each>
-                </xsl:variable>
-                <xsl:choose>
-                    <xsl:when test="string-length($result) &gt; 0">
-                        <xsl:value-of select="$result"/>
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <xsl:message terminate="yes">#263 p5:get_get_from_url - cannot get get value=<xsl:value-of select="$get"/> from url string = <xsl:value-of select="$p5:url"/></xsl:message>
-                    </xsl:otherwise>
-                </xsl:choose>
-            </xsl:when>
-            <xsl:otherwise>
-                <xsl:message terminate="yes">#268 p5:get_get_from_url url=<xsl:value-of select="$p5:url"/> dont seems correct to extract get</xsl:message>
-            </xsl:otherwise>
-        </xsl:choose>
-        
-    </xsl:function>
-    
-    <xsl:template match="@next" mode="p5:fid">
-        <!-- https://biuro.biall-net.pl/SE/version-git/wfs-data.php?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=default_db__x3A__BI_audit_MSIG_name%3ABI_audit_MSIG_name&amp;sid=p3s8biqkc8jd4q0ihbqqhr8ueeub7hka9g8nagh3haiqrep37fr6hngspi0m3155v4gl0g2te86dd2hosir0f6l83t7t0j8fsoqq3k2&amp;resolveDepth=4&amp;resolve=all&amp;PRIMARYKEY=7666&amp;SRSNAME=EPSG%3A3003&amp;startIndex=50000&amp;maxFeatures20 -->
-        <xsl:variable name="TYPENAME" select="p5:get_get_from_url(.,'TYPENAME')"/>
-        <xsl:variable name="PRIMARYKEY" select="p5:get_get_from_url(.,'PRIMARYKEY')"/>
-        <xsl:variable name="TYPENAME">
-            <xsl:choose>
-                <xsl:when test="substring-after($TYPENAME,':')">
-                    <xsl:value-of select="substring-after($TYPENAME,':')"/>
-                </xsl:when>
-                <xsl:otherwise>
-                    <xsl:value-of select="$TYPENAME"/>
-                </xsl:otherwise>
-            </xsl:choose>
-        </xsl:variable>
-        <xsl:value-of select="concat($TYPENAME,'.',$PRIMARYKEY)"/>
-    </xsl:template>
-    
-    <xsl:function  name="p5:fid">
-        <xsl:param name="p5:next"/>
-        <xsl:choose>
-            <xsl:when test="contains($p5:next,'PRIMARYKEY=')">
-                <xsl:variable name="TYPENAME" select="p5:get_get_from_url($p5:next,'TYPENAME')"/>
-                <xsl:variable name="PRIMARYKEY" select="p5:get_get_from_url($p5:next,'PRIMARYKEY')"/>
-                <xsl:value-of select="concat($TYPENAME,'.',$PRIMARYKEY)"/>
-            </xsl:when>
-            <xsl:otherwise>
-                <xsl:message>#312 cannot retrieve PRIMARYKEY from propably backreffed url=<xsl:value-of select="$p5:next"/></xsl:message>
-            </xsl:otherwise>
-            
-        </xsl:choose>
-        <!-- https://biuro.biall-net.pl/SE/version-git/wfs-data.php?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=default_db__x3A__BI_audit_MSIG_name%3ABI_audit_MSIG_name&amp;sid=p3s8biqkc8jd4q0ihbqqhr8ueeub7hka9g8nagh3haiqrep37fr6hngspi0m3155v4gl0g2te86dd2hosir0f6l83t7t0j8fsoqq3k2&amp;resolveDepth=4&amp;resolve=all&amp;PRIMARYKEY=7666&amp;SRSNAME=EPSG%3A3003&amp;startIndex=50000&amp;maxFeatures20 -->
-        
-    </xsl:function>
-    
-    <xsl:template name="simpleTypeMakeOgcFilter_merge"><!-- do zrobienia polaczonego filtru OGC -->
-        <xsl:param name="simpleTypeMakeOgcFilter" required="yes"/>
-        <xsl:param name="xpath_dita" required="yes"/> <!-- @value -->
-        <xsl:param name="xpath_value_dita" required="yes"/> <!-- @xpath_value -->
-      <!--  <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="number($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>
-        <xsl:value-of select="'&amp;Filter=&lt;ogc:Filter&gt;'"/>
-        <xsl:variable name="Filter">
-            <And>
-                <xsl:for-each select="$RelatedFilter">
-                    <ogc:PropertyIsEqualTo>
-                        <ogc:PropertyName><xsl:value-of select="$xpath_dita"/></ogc:PropertyName>
-                        <ogc:Literal><xsl:value-of select="$xpath_value_dita"/></ogc:Literal>
-                    </ogc:PropertyIsEqualTo>
-                </xsl:for-each>
-                <ogc:PropertyIsEqualTo>
-                    <ogc:PropertyName><xsl:value-of select="$xpath_dita"/></ogc:PropertyName>
-                    <ogc:Literal><xsl:value-of select="$xpath_value_dita"/></ogc:Literal>
-                </ogc:PropertyIsEqualTo>
-                <And>
-                    <xsl:for-each select="$simpleTypeMakeOgcFilter/*">
-                        <xsl:copy-of select="."/>
-                    </xsl:for-each>
-                </And>
-            </And>
-        </xsl:variable>
-        <xsl:apply-templates select="$Filter" mode="simpleTypeMakeOgcFilter_merge_apply"/>
-        <xsl:value-of select="'&lt;/ogc:Filter&gt;'"/>
-    </xsl:template>
-    
-    <xsl:template name="xpath_filter_apply"> <!-- do przetworzenia filtra na podstawie danych wezla poprzedniego $input_obj_with_xpath oraz podanych parametrow @xpath i @xpath_value -->
-        <xsl:param name="input_obj_with_xpath" required="yes"/>
-        <xsl:param name="xpath" required="yes"/>
-        <xsl:param name="xpath_value" required="yes"/>
-        <xsl:variable name="xpath_value_token">
-            <xsl:for-each select=" tokenize($xpath_value,'/')">
-                <xsl:if test="number($debug) &gt; 2"><xsl:message>#341 znalazlem dla=<xsl:value-of select="."/>; ; <xsl:value-of select="$input_obj_with_xpath/node()[@xpath=current()]"/></xsl:message></xsl:if>
-                <xsl:if test="$input_obj_with_xpath/node()[@xpath=current()]">
-                    <xsl:copy-of select="$input_obj_with_xpath/node()[@xpath=current()]"/>
-                </xsl:if><!-- todo to jest bledne ale dziala tymczasowo-->
-            </xsl:for-each>
-        </xsl:variable>
-        <xsl:if test="number($debug) &gt; 2"><xsl:message>#345 ustalam na <xsl:value-of select="$xpath_value_token/node()[1]/text()"/>;</xsl:message></xsl:if>
-        <!--<xsl:value-of select="$xpath_value_token/node()[1]/text()"/>-->
-        <xsl:value-of select="$xpath_value_token"/>
-    </xsl:template>
-    
-    
-    
-    <!--${simpleSchema_dir}/${namespace_prefix_p5_tr_map}/${main_build_recurse_ant.tr_map_sed}.xml-->
-    <xsl:template name="main">
-       
-        <xsl:param name="typeName" select="$typeName"/>
-        <xsl:param name="api" select="$api"/>
-        <xsl:param name="protocol" select="$protocol"/>
-        <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"/>; $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" >
-                 <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" >
-                 <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"/>
-             
-             <xsl:variable name="get_wfs_recurse_xsl:simpleTypeMakeOgcFilter" select="get_wfs_recurse_xsl:simpleTypeMakeOgcFilter($get_wfs_recurse_xsl:GetsimpleSchema)"/>
-             <xsl:variable name="get_wfs_recurse_xsl:RelatedFilter" select="get_wfs_recurse_xsl:RelatedFilter($get_wfs_recurse_xsl:GetsimpleSchema)"/>
-             <xsl:variable name="OGC_Filter">
-                 <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>
-             </xsl:variable>
-        <xsl:if test="number($debug) &gt; 3">
-              <xpath_dita>
-                  <xsl:value-of select="$xpath_dita"></xsl:value-of>
-              </xpath_dita>
-              <xpath_value_dita>
-                  <xsl:value-of select="$xpath_value_dita"></xsl:value-of>
-              </xpath_value_dita>
-                      <!--  <get_wfs_recurse_xsl:simpleTypeMakeOgcFilter>
-                            <xsl:copy-of select="$get_wfs_recurse_xsl:simpleTypeMakeOgcFilter"/>
-                        </get_wfs_recurse_xsl:simpleTypeMakeOgcFilter>
-                        <Filter>
-                            <xsl:copy-of select="$OGC_Filter"/>
-                        </Filter>-->
-             </xsl:if>
-             <!--<xsl:variable name="request_string" select="concat('?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=',$get_wfs_recurse_xsl:typeNameRealResource,$OGC_Filter,'&amp;SRSNAME=EPSG:3003')"/>--> <!-- &amp;MAXFEATURES=15 -->
-             
-             <xsl:variable name="request_string">
-                 <xsl:call-template name="get_wfs_recurse_xsl:request_string">
-                     <xsl:with-param name="OGC_Filter" select="$OGC_Filter"/>
-                     <xsl:with-param name="REQUEST.TYPE" select="'GetFeature'"/>
-                     <xsl:with-param name="REQUEST.TYPENAME" select="$get_wfs_recurse_xsl:typeNameRealResource"/>
-                 </xsl:call-template>
-             </xsl:variable>
-             
-             <!--<xsl:variable name="url_string" select="concat($protocol,$username,':',$username.pass,'@',$api,'/',$targetNamespace_DEFAULTS_prefix,'/',$request_string)"/>-->
-             <xsl:message>#265 test $php_session_id_ok.string=<xsl:value-of select="$php_session_id_ok.string"/>; $url_string=<xsl:value-of select="$request_string"/> 
-                 p5:links.recurse_level.limit = <xsl:value-of select="$p5:links.recurse_level.limit"/>
-                 p5:links.next.recurse_level.limit = <xsl:value-of select="$p5:links.next.recurse_level.limit"/>
-                 resolveDepth = <xsl:value-of select="$resolveDepth"/>
-                 
-             </xsl:message>
-             <xsl:variable name="get_wfs_recurse_xsl:wfs_response" select="doc($request_string)"/>
-        <xsl:if test="number($debug) &gt; 5">
-                 <wfs_response>
-                     <request>Retrieving <xsl:value-of select="$request_string"/></request>
-                     <oryg>https://                     biuro.biall-net.pl/SE/version-git/wfs-data.php/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=p5_default_db:CRM_PROCES&amp;SRSNAME=EPSG:3003&amp;MAXFEATURES=15</oryg>
-                     <test>https://a.binder:@biuro.biall-net.pl/SE/version-git/wfs-data.php/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=p5_default_db:PROCES_INIT&amp;SRSNAME=EPSG:3003&amp;MAXFEATURES=15</test>
-                     
-                     <!--<xsl:copy-of select="$wfs_response"/>-->
-                     <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response"/>
-                 </wfs_response>
-             </xsl:if>
-            <xsl:variable name="get_wfs_recurse_xsl:context.nodes">
-                <get_wfs_recurse_xsl:context.nodes>
-                    <xsl:apply-templates mode="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:wfs_response"/>
-                </get_wfs_recurse_xsl:context.nodes>
-            </xsl:variable>
-            <xsl:variable name="get_wfs_recurse_xsl:context.PRIMARYKEY">
-                <get_wfs_recurse_xsl:context.PRIMARYKEY>
-                        <xsl:for-each select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember/*">
-                            <get_wfs_recurse_xsl:nodes>
-                                <xsl:attribute name="fid" select="@fid"/>
-                            </get_wfs_recurse_xsl:nodes>
-                        </xsl:for-each>
-                </get_wfs_recurse_xsl:context.PRIMARYKEY>
-            </xsl:variable>
-            <xsl:if test="number($debug) &gt; 3">
-                 <xsl:copy-of select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
-                 <xsl:copy-of select="$get_wfs_recurse_xsl:context.nodes"/>
-            </xsl:if>
-            <xsl:choose>
-                <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="number($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="number($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="$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:with-param name="resolveDepth.current" select="1"/>
-                        </xsl:apply-templates>
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <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:with-param name="resolveDepth.current" select="1"/>
-                            </xsl:apply-templates>
-                        </RelatedFeatureRoot>
-                    </xsl:otherwise>
-                </xsl:choose>
-                
-            </xsl:otherwise>
-        </xsl:choose>
-        <!--</RelatedFeatureRoot>-->
-    </xsl:template>
-    
-    
-    <xsl:template match="*[@xlink:href]" mode="p5:links.evaluate"  xpath-default-namespace="http://www.opengis.net/wfs">
-        <xsl:param name="p5:links.recurse_level" select="1"/>
-        <xsl:param name="p5:links.next.recurse_level" select="1"/>
-        <xsl:param name="get_wfs_recurse_xsl:context.nodes" required="yes"/>
-        <xsl:param name="get_wfs_recurse_xsl:context.PRIMARYKEY" required="yes"/>
-        <xsl:param name="debug.last_wfs_request" required="yes"/>
-        <xsl:variable name="p5:fid" select="get_wfs_recurse_xsl:REQUEST.fid(@xlink:href)"/>
-        <!--<xlink:href.evaluate>-->
-           <!-- <xsl:copy>
-                <xsl:copy-of select="@*"/>-->
-        <xsl:if test="number($debug) &gt; 3">
-            <xlink:href.debug509>
-                <xsl:attribute name="debug.last_wfs_request" select="$debug.last_wfs_request"/>
-                <xsl:copy-of select="@*"/>
-                <xsl:copy-of select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
-                <xsl:copy-of select="$get_wfs_recurse_xsl:context.nodes"/>
-            </xlink:href.debug509>
-        </xsl:if>
-                <xsl:message>#516-A  name()<xsl:value-of select="name()"/>; ORIGINAL_@xlink:href=<xsl:value-of select="@xlink:href"/>;</xsl:message>
-                <xsl:comment>#516-A  name()<xsl:value-of select="name()"/>; ORIGINAL_@xlink:href=<xsl:value-of select="@xlink:href"/>;</xsl:comment>
-                <xsl:variable name="xlink:request_string">
-                    <xsl:apply-templates mode="xlink:request_string" select=".">
-                        <xsl:with-param name="p5:links.recurse_level" select="$p5:links.recurse_level"/>
-                    </xsl:apply-templates>
-                </xsl:variable>
-                <xsl:message>#516-A anchestors.count(<xsl:value-of select="count(ancestor::node())"/>); context.PRIMARYKEY count(<xsl:value-of select="count($get_wfs_recurse_xsl:context.PRIMARYKEY//*[@fid])"/>); previous @fid=count(<xsl:value-of select="count(root()//*[@fid])"/>);  get_wfs_recurse_xsl:context.nodes count(<xsl:value-of select="count($get_wfs_recurse_xsl:context.nodes//*[@fid])"/>); debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:message>
-                <xsl:comment>#516-A anchestors.count(<xsl:value-of select="count(ancestor::node())"/>); context.PRIMARYKEY count(<xsl:value-of select="count($get_wfs_recurse_xsl:context.PRIMARYKEY//*[@fid])"/>); previous @fid=count(<xsl:value-of select="count(root()//*[@fid])"/>);  get_wfs_recurse_xsl:context.nodes count(<xsl:value-of select="count($get_wfs_recurse_xsl:context.nodes//*[@fid])"/>); debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:comment>
-                <!--<xsl:message>#401 previous @fid
-                    <xsl:for-each select="root()//*[@fid]">
-                        <xsl:value-of select="@fid"/>
-                    </xsl:for-each>
-                </xsl:message>-->
-                <xsl:choose>
-                    <xsl:when test="$get_wfs_recurse_xsl:context.nodes//*[@fid = get_wfs_recurse_xsl:REQUEST.fid( current()/@xlink:href)]">
-                        <xsl:message>#398-A1 match="*[@xlink:href]" - LOOP CONTEXT.nodes DETECTED  at p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; at p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; BYPASSING  @xlink:href=<xsl:value-of select="@xlink:href"/>; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:message>
-                        <xsl:comment>#398-A1 match="*[@xlink:href]" - LOOP CONTEXT.nodes DETECTED  at p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; at p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/> BYPASSING  @xlink:href=<xsl:value-of select="@xlink:href"/>; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:comment>
-                    </xsl:when>
-                    <xsl:when test="root()//*[number(@root.distance) &lt; number($p5:links.loop.context.nodes.min.distance) and @fid = get_wfs_recurse_xsl:REQUEST.fid( current()/@xlink:href)]">
-                        <xsl:message>#398-A2 match="*[@xlink:href]" - LOOP DETECTED  for <xsl:value-of select="root()//*[@fid = get_wfs_recurse_xsl:REQUEST.fid( current()/@xlink:href)]/concat(@fid,' dist:',@root.distance)"/>  at p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; at p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; BYPASSING  @xlink:href=<xsl:value-of select="@xlink:href"/>; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:message>
-                        <xsl:comment>#398-A2 match="*[@xlink:href]" - LOOP DETECTED  for <xsl:value-of select="root()//*[@fid = get_wfs_recurse_xsl:REQUEST.fid( current()/@xlink:href)]/concat(@fid,' dist:',@root.distance)"/>  at p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; at p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/> BYPASSING  @xlink:href=<xsl:value-of select="@xlink:href"/>; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:comment>
-                    </xsl:when>
-                    <xsl:when test="p5:links.recurse_level.limit($p5:links.recurse_level)">
-                        <xsl:message>#398-B match="*[@xlink:href]" HIT LIMIT p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; at p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; BYPASSING  @xlink:href=<xsl:value-of select="@xlink:href"/>; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:message>
-                        <xsl:comment>#398-B match="*[@xlink:href]" HIT LIMIT p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; at p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; BYPASSING  @xlink:href=<xsl:value-of select="@xlink:href"/>; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:comment>
-                        <xsl:copy-of select="."/>
-                    </xsl:when>
-                    <xsl:when test=" string-length($xlink:request_string) = 0">
-                        <xsl:message>#402-C match="*[@xlink:href]" stopped recursion due to ERROR in empty $xlink:request_string - DEBUGGING TODO 2018-01-5; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:message>
-                        <xsl:comment>#402-C match="*[@xlink:href]" stopped recursion due to ERROR in empty $xlink:request_string - DEBUGGING TODO 2018-01-5; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:comment>
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <xsl:message>#398-D  match="*[@xlink:href]"-B count(.)=<xsl:value-of select="count(.)"/>; continuing still digging at @xlink:href xlink:request_string=<xsl:value-of select="$xlink:request_string"/>; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:message>
-                        <xsl:comment>#398-D  match="*[@xlink:href]"-B count(.)=<xsl:value-of select="count(.)"/>; continuing still digging at @xlink:href xlink:request_string=<xsl:value-of select="$xlink:request_string"/>; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:comment>
-                        
-                        <!--<xsl:variable name="xlink:request_string">
-                            <xsl:apply-templates mode="xlink:request_string" select="."/>
-                        </xsl:variable>-->
-                        <xsl:apply-templates select=" get_wfs_recurse_xsl:wfs_response($xlink:request_string)" mode="p5:links.evaluate">
-                            <xsl:with-param name="p5:links.recurse_level" select="number($p5:links.recurse_level) + 1"/>
-                            <xsl:with-param name="p5:links.next.recurse_level" select="1"/> <!-- $p5:links.next.recurse_level TODO researching start from beginning -->
-                            <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.merge($get_wfs_recurse_xsl:context.PRIMARYKEY,$p5:fid)"/>
-                            <xsl:with-param name="debug.last_wfs_request" select="$xlink:request_string"/>
-                        </xsl:apply-templates>
-                    </xsl:otherwise>
-                    
-                </xsl:choose>
-                
-            <!--</xsl:copy>-->
-        <!--</xlink:href.evaluate>-->
-    </xsl:template>
-    
-    
-    <xsl:template match="*" mode="p5:links.evaluate"  xpath-default-namespace="http://www.opengis.net/wfs">
-        <xsl:param name="p5:links.recurse_level" select="1"/>
-        <xsl:param name="p5:links.next.recurse_level" select="1"/>
-        <xsl:param name="get_wfs_recurse_xsl:context.nodes" required="yes"/>
-        <xsl:param name="get_wfs_recurse_xsl:context.PRIMARYKEY" required="yes"/>
-        <xsl:param name="debug.last_wfs_request" required="yes"/>
-       <!-- <xsl:element name="{name()}" inherit-namespaces="yes">
-            <xsl:copy-of select="namespace::node()"/>-->
-        <xsl:choose>
-            <xsl:when test="count($get_wfs_recurse_xsl:context.nodes//*[@fid =  current()/@fid ]) &gt; 1">
-                <xsl:message>#613-A1 match="*[@xlink:href]" - LOOP CONTEXT.nodes DETECTED  at p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; at p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; BYPASSING current()/@fid=<xsl:value-of select="@fid"/>; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:message>
-                <xsl:comment>#613-A1 match="*[@xlink:href]" - LOOP CONTEXT.nodes DETECTED  at p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; at p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; BYPASSING current()/@fid=<xsl:value-of select="@fid"/>; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:comment>
-                <xsl:if test="number($debug) &gt; 3">
-                    <xsl:copy-of select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
-                    <xsl:copy-of select="$get_wfs_recurse_xsl:context.nodes"/>
-                </xsl:if>
-            </xsl:when>
-            <xsl:otherwise>
-                <xsl:copy><!-- debug -->
-                    <xsl:copy-of select="@*"/>
-                    <!--<xsl:attribute name="debug.566"> match=* mode=p5:links.evaluate</xsl:attribute>-->
-                    <xsl:apply-templates mode="xlink:href.evaluate" select="@xlink:href">
-                        <xsl:with-param name="p5:links.recurse_level" select="$p5:links.recurse_level"/>
-                        <xsl:with-param name="p5:links.next.recurse_level" select="$p5:links.next.recurse_level"/>
-                        <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="$debug.last_wfs_request"/>
-                    </xsl:apply-templates>
-                    <xsl:apply-templates mode="p5:links.evaluate">
-                        <xsl:with-param name="p5:links.recurse_level" select="$p5:links.recurse_level"/>
-                        <xsl:with-param name="p5:links.next.recurse_level" select="$p5:links.next.recurse_level"/>
-                        <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="$debug.last_wfs_request"/>
-                    </xsl:apply-templates>
-                    <!--</xsl:element>-->
-                </xsl:copy>
-            </xsl:otherwise>
-        </xsl:choose>
-        
-        
-        <!--<xsl:element name="{name()}" inherit-namespaces="yes"  xpath-default-namespace="http://www.opengis.net/wfs">
-            
-            <xsl:apply-templates mode="p5:links.evaluate"/>
-        </xsl:element>-->
-        
-    </xsl:template>
-    
-    <xsl:function name="p5:links.recurse_level.limit">
-        <xsl:param name="p5:links.recurse_level"/>
-        <xsl:choose>
-            <xsl:when test="number($p5:links.recurse_level) &gt;= number($p5:links.recurse_level.limit)">
-                <xsl:value-of select="'limit hit'"/>
-                <xsl:message>#431-R LIMIT HIT p5:links.recurse_level.limit($p5:links.recurse_level.limit at <xsl:value-of select="$p5:links.recurse_level"/>);</xsl:message>
-                <xsl:comment>#431-R LIMIT HIT p5:links.recurse_level.limit($p5:links.recurse_level.limit at <xsl:value-of select="$p5:links.recurse_level"/>)</xsl:comment>
-            </xsl:when>
-        </xsl:choose>
-    </xsl:function>
-    
-    <xsl:function name="p5:links.next.recurse_level.limit">
-        <xsl:param name="p5:links.next.recurse_level"/>
-        <xsl:choose>
-            <xsl:when test="number($p5:links.next.recurse_level.limit) &gt; number($p5:links.next.recurse_level.limit)">
-                <xsl:value-of select="'limit hit'"/>
-                <xsl:message>#431-N LIMIT HIT p5:links.next.recurse_level.limit(<xsl:value-of select="$p5:links.next.recurse_level.limit"/>) at p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>;</xsl:message>
-                <xsl:comment>#431-N LIMIT HIT p5:links.next.recurse_level.limit(<xsl:value-of select="$p5:links.next.recurse_level.limit"/>) at p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>;</xsl:comment>
-            </xsl:when>
-        </xsl:choose>
-    </xsl:function>
-    
-    <xsl:function name="get_wfs_recurse_xsl:php_session_id_ok.string">
-        <xsl:param name="php_session_id_ok.string"/>
-        <xsl:if test=" string-length($php_session_id_ok.string) &gt; 0">
-            <xsl:value-of select="concat('&amp;sid=',normalize-space($php_session_id_ok.string))"/>
-        </xsl:if>
-    </xsl:function>
-    
-    <xsl:function name="get_wfs_recurse_xsl:api_recurse.request">
-        <xsl:param name="api_recurse"/>
-        <xsl:param name="p5:links.recurse_level"/>
-        <xsl:choose>
-            <xsl:when test="$api_recurse and ( ( number($p5:links.recurse_level) + number($resolveDepth) ) &gt; $p5:links.recurse_level.limit )">
-                <xsl:message>#668 reducing $resolveDepth to  $p5:links.recurse_level.limit-$p5:links.recurse_level == <xsl:value-of select="($p5:links.recurse_level.limit - $p5:links.recurse_level )"/> to not extend expected deep traverse </xsl:message>
-                <xsl:value-of select="concat('&amp;resolveDepth=',($p5:links.recurse_level.limit - $p5:links.recurse_level ),'&amp;resolve=all')"/>
-            </xsl:when>
-            <xsl:when test="$api_recurse and  number($p5:links.recurse_level)">
-                <xsl:value-of select="concat('&amp;resolveDepth=',$resolveDepth,'&amp;resolve=all')"/>
-            </xsl:when>
-        </xsl:choose>
-    </xsl:function>
-    
-    <xsl:function name="get_wfs_recurse_xsl:api_recurse.request">
-        <xsl:param name="api_recurse"/>
-        <xsl:choose>
-            <xsl:when test="$api_recurse">
-                <xsl:value-of select="concat('&amp;resolveDepth=',$resolveDepth,'&amp;resolve=all')"/>
-            </xsl:when>
-        </xsl:choose>
-    </xsl:function>
-    
-    <xsl:function name="get_wfs_recurse_xsl:username_and_pass">
-        <xsl:param name="php_session_id_ok.string"/>
-        <xsl:choose>
-            <xsl:when test="string-length($php_session_id_ok.string) &gt; 0"/>
-            <xsl:otherwise><xsl:value-of select="concat($username,':',$username.pass,'@')"/></xsl:otherwise>
-        </xsl:choose>
-    </xsl:function>
-    
-    <xsl:function name="get_wfs_recurse_xsl:api">
-        <xsl:param name="xlink:href"/>
-        <xsl:variable name="string_tokens" select="count(tokenize($xlink:href,'/'))"/>
-        <xsl:variable name="get_wfs_recurse_xsl:api">
-        <xsl:for-each select="tokenize($xlink:href,'/')[ position() &lt; $string_tokens]">
-            <xsl:value-of select="."/><xsl:text>/</xsl:text>
-        </xsl:for-each>
-        </xsl:variable>
-        <xsl:choose>
-            <xsl:when test=" contains( substring-after($get_wfs_recurse_xsl:api/text(),'://'), substring-before($api,'/'))">
-                <xsl:message>#476 TODO using default parameter from $api=<xsl:value-of select="$api"/> instead of detected <xsl:value-of select="substring-after($get_wfs_recurse_xsl:api/text(),'://')"/> consider using binding $TargetNamespaceBindingsApiUrl</xsl:message>
-                <xsl:value-of select="$api"/>
-            </xsl:when>
-            <xsl:otherwise>
-                <xsl:value-of select=" substring-after($get_wfs_recurse_xsl:api/text(),'://')"/>
-            </xsl:otherwise>
-        </xsl:choose>
-        
-        <!--<xsl:value-of select="tokenize($xlink:href,'/')[ 1 to count(tokenize($xlink:href,'.'))]"/>-->
-    </xsl:function>
-   
-    <xsl:function name="get_wfs_recurse_xsl:REQUEST.fid">
-        <xsl:param name="xlink:href"/>
-        <xsl:choose>
-            <xsl:when test="substring-after($xlink:href,'#')">
-                <xsl:value-of select=" substring-after($xlink:href,'#')"/>
-            </xsl:when>
-            <xsl:otherwise><xsl:value-of select="false()"/></xsl:otherwise>
-        </xsl:choose>
-
-    </xsl:function>
-   
-    <xsl:function name="get_wfs_recurse_xsl:REQUEST.TYPE.PRIMARYKEY">
-        <xsl:param name="xlink:href"/>
-        
-        <xsl:choose>
-            <xsl:when test=" string-length(tokenize($xlink:href,'\.')[ count(tokenize($xlink:href,'\.'))]) &gt; 0">
-                <xsl:value-of select="concat('&amp;PRIMARYKEY=',tokenize($xlink:href,'\.')[ count(tokenize($xlink:href,'\.')) ])"/>
-            </xsl:when>
-            <xsl:otherwise>
-                <xsl:message terminate="no">#495 ERROR with detecting get_wfs_recurse_xsl:REQUEST.TYPE.PRIMARYKEY  from <xsl:value-of select="$xlink:href"/>
-                    tokens count=<xsl:value-of select="count(tokenize($xlink:href,'\.'))"/>
-                </xsl:message>
-            </xsl:otherwise>
-        </xsl:choose>
-    </xsl:function>
-    
-    <xsl:function name="get_wfs_recurse_xsl:protocol">
-        <xsl:param name="xlink:href"/>
-        <xsl:value-of select=" concat(substring-before($xlink:href,'://'),'://')"/>
-    </xsl:function>
-    
-    <xsl:template match="*[@xlink:href]" mode="xlink:request_string">
-        <xsl:param name="protocol" select="get_wfs_recurse_xsl:protocol(@xlink:href)"/>
-        <xsl:param name="api" select="get_wfs_recurse_xsl:api(@xlink:href)"/>
-        <xsl:param name="targetNamespace_DEFAULTS_prefix" select="$targetNamespace_DEFAULTS_prefix"/>
-        <xsl:param name="username" select="$username"/>
-        <xsl:param name="username.pass" select="$username.pass"/>
-        <xsl:param name="REQUEST.SERVICE" select="'WFS'"/>
-        <xsl:param name="REQUEST.VERSION" select="'1.0.0'"/>
-        <xsl:param name="REQUEST.TYPE" select="'GetFeature'"/>
-        <!--<xsl:param name="REQUEST.MAXFEATURES" />-->
-        <xsl:param name="REQUEST.TYPENAME" select="name()"/>
-        <xsl:param name="OGC_Filter"/>
-        <xsl:param name="REQUEST.SRSNAME" select="'EPSG:3003'"/>
-        <xsl:param name="p5:links.recurse_level"/>
-        <xsl:param name="api.local_location" select="'SE/version-git/wfs-data.php/default_db/'"/>
-        <xsl:variable name="php_session_id_ok.string" select="get_wfs_recurse_xsl:php_session_id_ok.string($php_session_id_ok.string)"/>
-        <xsl:variable name="api_recurse.request" select="get_wfs_recurse_xsl:api_recurse.request($api_recurse)"/>
-        <xsl:variable name="username_and_pass" select="get_wfs_recurse_xsl:username_and_pass($php_session_id_ok.string)"/>
-        <xsl:variable name="REQUEST.TYPE.PRIMARYKEY" select="get_wfs_recurse_xsl:REQUEST.TYPE.PRIMARYKEY(@xlink:href)"/>
-        <xsl:variable name="REQUEST.MAXFEATURES">
-            <xsl:choose>
-                <xsl:when test="contains(@xlink:href,'&amp;maxFeatures=10')">
-                    <xsl:value-of select="concat('&amp;maxFeatures=',$MAXFEATURES)"/>
-                </xsl:when>
-                <xsl:when test="contains(@xlink:href,'&amp;maxFeatures=20')">
-                    <xsl:value-of select="concat('&amp;maxFeatures=',$MAXFEATURES)"/>
-                </xsl:when>
-                <xsl:when test="contains(@xlink:href,'maxFeatures')"/>
-                <xsl:otherwise><xsl:value-of select="concat('&amp;maxFeatures=',$MAXFEATURES)"/></xsl:otherwise>
-            </xsl:choose>
-        </xsl:variable>
-        
-        <xsl:if test="number($debug) &gt; 3"><xsl:message>#497 detected $api = <xsl:value-of select="$api"/>; </xsl:message>
-            <xsl:message>#497 REQUEST.TYPE.PRIMARYKEY=<xsl:value-of select="$REQUEST.TYPE.PRIMARYKEY"/>;</xsl:message>
-        </xsl:if>
-        <xsl:choose>
-            <xsl:when test=" string-length($REQUEST.TYPE.PRIMARYKEY) &gt; 0">
-                <xsl:value-of select="concat($protocol,$username_and_pass,$api,'?SERVICE=',$REQUEST.SERVICE,'&amp;VERSION=',$REQUEST.VERSION,'&amp;REQUEST=',$REQUEST.TYPE,'&amp;TYPENAME=',$REQUEST.TYPENAME,$php_session_id_ok.string,$api_recurse.request,$REQUEST.TYPE.PRIMARYKEY,'&amp;SRSNAME=',$REQUEST.SRSNAME,$REQUEST.MAXFEATURES)"/>
-            </xsl:when>
-            <xsl:otherwise>
-                <xsl:message>#532 ERROR with requests - debug it and stop recurse</xsl:message>
-            </xsl:otherwise>
-        </xsl:choose>
-        
-        
-    </xsl:template>
-    
-    
-    <xsl:function name="get_wfs_recurse_xsl:wfs_response">
-        <xsl:param name="request_string"/>
-        <xsl:message>#741 quering wfs for request_string= <xsl:value-of select="$request_string"/> ;</xsl:message>
-        <xsl:variable name="get_wfs_recurse_xsl:wfs_response" select="doc($request_string)"/>
-            <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:copy-of select="$get_wfs_recurse_xsl:wfs_response"/>
-    </xsl:function>
-    
-    
-    <xsl:template match="@*" mode="p5:links.evaluate">
-        <xsl:copy-of select="."/>
-    </xsl:template>
-    <xsl:template match="text()" mode="p5:links.evaluate">
-        <xsl:copy-of select="."/>
-    </xsl:template>
-    
-    <xsl:template match="p5:links" mode="p5:links.evaluate">
-        <xsl:param name="p5:links.recurse_level" select="1"/>
-        <xsl:param name="p5:links.next.recurse_level" select="1"/>
-        <xsl:param name="get_wfs_recurse_xsl:context.nodes"  required="yes"/>
-        <xsl:param name="get_wfs_recurse_xsl:context.PRIMARYKEY" required="yes"/>
-        <xsl:param name="debug.last_wfs_request" required="yes"/>
-        <xsl:variable name="php_session_id_ok.string">
-            <xsl:if test=" string-length($php_session_id_ok.string) &gt; 0">
-                <xsl:value-of select="concat('&amp;sid=',normalize-space($php_session_id_ok.string))"/>
-            </xsl:if>
-        </xsl:variable>
-        <!--<xsl:variable name="api_recurse.request">
-            <xsl:choose>
-                <xsl:when test="$api_recurse">
-                    <xsl:value-of select="concat('&amp;resolveDepth=',$resolveDepth,'&amp;resolve=all')"/>
-                </xsl:when>
-            </xsl:choose>
-        </xsl:variable>-->
-       <!-- <xsl:copy>-->
-            <p5:links><xsl:copy-of select="*"/></p5:links>
-            
-            <xsl:variable name="p5:fid" select="p5:fid(p5:next/text())"/>
-            <xsl:message>#684 debug match="p5:links" detected $p5:fid = <xsl:value-of select="$p5:fid"/></xsl:message>
-            <xsl:comment>#684 debug match="p5:links" detected $p5:fid = <xsl:value-of select="$p5:fid"/></xsl:comment>
-                <xsl:if test="number($debug) &gt; 3">
-                    <xsl:copy-of select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/> 
-                    <xsl:copy-of select="$get_wfs_recurse_xsl:context.nodes"/>
-                </xsl:if>
-              <xsl:choose>
-                  <xsl:when test="$get_wfs_recurse_xsl:context.nodes//*[@fid = $p5:fid ]">
-                      <xsl:message>#430-A1 match="*[@xlink:href]" - LOOP CONTEXT.nodes DETECTED  at p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; at p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; BYPASSING  p5:next/text()=<xsl:value-of select="p5:next/text()"/>; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:message>
-                      <xsl:comment>#430-A1 match="*[@xlink:href]" - LOOP CONTEXT.nodes DETECTED  at p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; at p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/> BYPASSING  p5:next/text()=<xsl:value-of select="p5:next/text()"/>; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:comment>
-                  </xsl:when>
-                  <xsl:when test="number($p5:links.recurse_level) &gt;= number($p5:links.recurse_level.limit)">
-                      <xsl:message>#430 STOPPED digging links by HIT $p5:links.recurse_level.limit at <xsl:value-of select="$p5:links.recurse_level"/>; at p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>;</xsl:message>
-                      <xsl:comment>#430 STOPPED digging links by HIT $p5:links.recurse_level.limit at <xsl:value-of select="$p5:links.recurse_level"/>; at p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>;</xsl:comment>
-                  </xsl:when>
-                  <xsl:when test="$get_wfs_recurse_xsl:context.PRIMARYKEY//*[@fid = $p5:fid]">
-                      <xsl:message> #690 STOPPED match="p5:links" DETECTED PRIMARYKEY FUTURE LOOP BY PRIMARY KEY $p5:fid=<xsl:value-of select="$p5:fid"/>;</xsl:message>
-                      <xsl:comment> #690 STOPPED match="p5:links" DETECTED PRIMARYKEY FUTURE LOOP BY PRIMARY KEY $p5:fid=<xsl:value-of select="$p5:fid"/>;</xsl:comment>
-                  </xsl:when>
-                  <xsl:when test="$get_wfs_recurse_xsl:context.PRIMARYKEY//*[@fid = $p5:fid]">
-                      <xsl:message> #691 STOPPED match="p5:links" DETECTED FUTURE LOOP BY PRIMARY KEY $p5:fid=<xsl:value-of select="$p5:fid"/>;</xsl:message>
-                      <xsl:comment> #691 STOPPED match="p5:links" DETECTED FUTURE LOOP BY PRIMARY KEY $p5:fid=<xsl:value-of select="$p5:fid"/>;</xsl:comment>
-                  </xsl:when>
-                  <xsl:otherwise>
-                      <xsl:variable name="MAXFEATURES.request">
-                          <xsl:choose>
-                              <xsl:when test="contains(p5:next/text(),'maxFeatures=10')">
-                                  <xsl:value-of select="concat('&amp;maxFeatures=',$MAXFEATURES)"/>
-                              </xsl:when>
-                              <xsl:when test="contains(p5:next/text(),'maxFeatures=20')">
-                                  <xsl:value-of select="concat('&amp;maxFeatures=',$MAXFEATURES)"/>
-                              </xsl:when>
-                              <xsl:when test="contains(p5:next/text(),'maxFeatures')"/>
-                              <xsl:otherwise><xsl:value-of select="concat('&amp;maxFeatures=',$MAXFEATURES)"/></xsl:otherwise>
-                          </xsl:choose>
-                      </xsl:variable>
-                      
-                      <xsl:variable name="request_string" select="concat(p5:next/text(),$php_session_id_ok.string,get_wfs_recurse_xsl:api_recurse.request($api_recurse,$p5:links.recurse_level),$MAXFEATURES.request)"/> <!-- ,'&amp;maxFeatures=999' -->
-                      <xsl:message>#415 $p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>;  p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; requesting p5:links <xsl:value-of select="$request_string"/> ; orig from next (<xsl:copy-of select="p5:next/@*"/>)</xsl:message>
-                      <xsl:comment>#415 $p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>;  p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; requesting p5:links <xsl:value-of select="$request_string"/> ; orig from next (<xsl:copy-of select="p5:next/@*"/>)</xsl:comment>
-                      <!--<request_string>
-              <xsl:copy-of select="$request_string"/>
-              </request_string>-->
-                      <xsl:variable name="get_wfs_recurse_xsl:wfs_response" select="doc($request_string)"/>
-                      
-                      <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:choose>
-                          <xsl:when test="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/@next">
-                              <!--<debug.438>-->
-                                <xsl:comment>360-recurse-A  $p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>;  p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; to parse to retrieve links and merge xml <xsl:value-of select="$get_wfs_recurse_xsl:wfs_response//p5:next/text()"/></xsl:comment>
-                              <xsl:message> #360-recurse-A $p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; to parse to retrieve links and merge xml <xsl:value-of select="$get_wfs_recurse_xsl:wfs_response//p5:next/text()"/></xsl:message>
-                                  <xsl:apply-templates mode="#current" select="$get_wfs_recurse_xsl:wfs_response">
-                                      <xsl:with-param name="p5:links.recurse_level" select="number($p5:links.recurse_level)"/> <!-- + 1  --><!-- setting to 1 again to research child node -->
-                                      <xsl:with-param name="p5:links.next.recurse_level" select="number($p5:links.next.recurse_level) + 1"/> 
-                                      <xsl:with-param name="get_wfs_recurse_xsl:context.nodes"  select="get_wfs_recurse_xsl:context.nodes.merge($get_wfs_recurse_xsl:context.nodes,$get_wfs_recurse_xsl:wfs_response)"/>
-                                      <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="get_wfs_recurse_xsl:context.PRIMARYKEY.merge($get_wfs_recurse_xsl:context.PRIMARYKEY,$p5:fid)"/>
-                                      <xsl:with-param name="debug.last_wfs_request" select="$request_string"/>
-                                  </xsl:apply-templates>
-                              <!--</debug.438>-->
-                          </xsl:when>
-                          <xsl:when test="$get_wfs_recurse_xsl:wfs_response//p5:next">
-                              <!--<debug.441>-->
-                                    <xsl:comment> #360-recurse-B $p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; to parse to retrieve links and merge xml <xsl:value-of select="$get_wfs_recurse_xsl:wfs_response//p5:next/text()"/></xsl:comment>
-                              <xsl:message> #360-recurse-B $p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; to parse to retrieve links and merge xml <xsl:value-of select="$get_wfs_recurse_xsl:wfs_response//p5:next/text()"/></xsl:message>
-                                  <xsl:apply-templates mode="#current" select="$get_wfs_recurse_xsl:wfs_response">
-                                      <xsl:with-param name="p5:links.recurse_level" select="$p5:links.recurse_level"/> <!-- + 1 ) -->
-                                      <xsl:with-param name="p5:links.next.recurse_level" select=" number($p5:links.next.recurse_level) + 1"/>
-                                      <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="get_wfs_recurse_xsl:context.nodes.merge($get_wfs_recurse_xsl:context.nodes,$get_wfs_recurse_xsl:wfs_response)"/>
-                                      <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="get_wfs_recurse_xsl:context.PRIMARYKEY.merge($get_wfs_recurse_xsl:context.PRIMARYKEY,$p5:fid)"/>
-                                      <xsl:with-param name="debug.last_wfs_request" select="$request_string"/>
-                                  </xsl:apply-templates>
-                              <!--</debug.441>-->
-                          </xsl:when>
-                          <xsl:otherwise>
-                              <!--<debug.447>-->
-                                <xsl:comment> #360-recurse-C $p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; to parse to retrieve links and merge xml <xsl:value-of select="$get_wfs_recurse_xsl:wfs_response//p5:next/text()"/></xsl:comment>
-                              <xsl:message> #360-recurse-C $p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; 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/@*"/>
-                                  <xsl:apply-templates mode="#current" select="$get_wfs_recurse_xsl:wfs_response">
-                                      <xsl:with-param name="p5:links.recurse_level" select="$p5:links.recurse_level"/> <!-- +1 -->
-                                      <xsl:with-param name="p5:links.next.recurse_level" select=" number($p5:links.next.recurse_level) + 1"/>
-                                      <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="get_wfs_recurse_xsl:context.nodes.merge($get_wfs_recurse_xsl:context.nodes,$get_wfs_recurse_xsl:wfs_response)"/>
-                                      <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="get_wfs_recurse_xsl:context.PRIMARYKEY.merge($get_wfs_recurse_xsl:context.PRIMARYKEY,$p5:fid)"/>
-                                      <xsl:with-param name="debug.last_wfs_request" select="$request_string"/>
-                                  </xsl:apply-templates>
-                              <!--</debug.447>-->
-                          </xsl:otherwise>
-                      </xsl:choose>
-                  </xsl:otherwise>
-              </xsl:choose>
-            
-        <!--</xsl:copy>-->
-    </xsl:template>
-    
-    
-    <xsl:template match="wfs:FeatureCollection[not(gml:featureMember/*)]" mode="p5:links.evaluate" >
-        <xsl:message>#461 finished digging at <xsl:value-of select="@next"/></xsl:message>
-    </xsl:template>
-    
-    
-    
-    <xsl:template match="wfs:FeatureCollection[@next and gml:featureMember/*]" mode="p5:links.evaluate" >
-        <xsl:param name="p5:links.recurse_level" select="1"/>
-        <xsl:param name="p5:links.next.recurse_level" select="1"/>
-        <xsl:param name="get_wfs_recurse_xsl:context.PRIMARYKEY" required="yes"/>
-        <xsl:param name="get_wfs_recurse_xsl:context.nodes" required="yes"/>
-        <xsl:param name="debug.last_wfs_request" required="yes"/>
-        
-        <xsl:variable name="php_session_id_ok.string">
-            <xsl:if test=" string-length($php_session_id_ok.string) &gt; 0">
-                <xsl:value-of select="concat('&amp;sid=',normalize-space($php_session_id_ok.string))"/>
-            </xsl:if>
-        </xsl:variable>
-        <xsl:variable name="MAXFEATURES.request">
-            <xsl:choose>
-                <xsl:when test="contains(@next,'&amp;maxFeatures=10')">
-                    <xsl:value-of select="concat('&amp;maxFeatures=',$MAXFEATURES)"/>
-                </xsl:when>
-                <xsl:when test="contains(@next,'&amp;maxFeatures=20')">
-                    <xsl:value-of select="concat('&amp;maxFeatures=',$MAXFEATURES)"/>
-                </xsl:when>
-                <xsl:when test="contains(@next,'maxFeatures')"/>
-                <xsl:otherwise><xsl:value-of select="concat('&amp;maxFeatures=',$MAXFEATURES)"/></xsl:otherwise>
-            </xsl:choose>
-        </xsl:variable>
-        <xsl:variable name="request_string" select="concat(@next,$MAXFEATURES.request)"/>
-       
-        <!--<xsl:variable name="api_recurse.request">
-            <xsl:choose>
-                <xsl:when test="1=1"></xsl:when>
-                <xsl:when test="$api_recurse">
-                    <xsl:value-of select="concat(@next,'&amp;resolveDepth=',$resolveDepth,'&amp;resolve=all')"/>
-                </xsl:when>
-            </xsl:choose>
-        </xsl:variable>-->
-        
-        
-        <xsl:variable name="p5:fid">
-            <xsl:choose>
-                <xsl:when test="contains(@next,'PRIMARYKEY=')">
-                    <xsl:apply-templates select="@next" mode="p5:fid"/>
-                </xsl:when>
-                <xsl:otherwise>
-                    <xsl:message>#833 cannot get PRIMARYKEY from Backreffed - check loop in another leaf from <xsl:value-of select="@next"/></xsl:message>
-                    <xsl:comment>#833 cannot get PRIMARYKEY from Backreffed - check loop in another leaf from <xsl:value-of select="@next"/></xsl:comment>
-                </xsl:otherwise>
-            </xsl:choose>
-        </xsl:variable>
-         <!-- ,'&amp;maxFeatures=999' -->
-        <xsl:message>#511 p5:fid=<xsl:value-of select="$p5:fid"/> $p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; requesting @next <xsl:value-of select="$request_string"/>; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:message>
-        <xsl:comment>#511 p5:fid=<xsl:value-of select="$p5:fid"/> $p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; requesting @next <xsl:value-of select="$request_string"/>; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:comment>
-        <!--<request_string>
-        <xsl:copy-of select="$request_string"/>
-        </request_string>-->
-        <xsl:choose>
-            <xsl:when test="$get_wfs_recurse_xsl:context.nodes//*[@fid =  current()/@fid ]">
-                <xsl:message>#692-A1 match="*[@xlink:href]" - LOOP CONTEXT.nodes DETECTED  at p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; at p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; BYPASSING current(); debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:message>
-                <xsl:comment>#692-A1 match="*[@xlink:href]" - LOOP CONTEXT.nodes DETECTED  at p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; at p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/> BYPASSING  current() debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:comment>
-            </xsl:when>
-            <xsl:when test="number($p5:links.recurse_level) &gt; $p5:links.recurse_level.limit">
-                <xsl:message>#692-R stopped digging for new p5:fid=<xsl:value-of select="$p5:fid"/> $p5:links.recurse_level.limit at <xsl:value-of select="$p5:links.recurse_level"/>; p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:message>
-                <xsl:comment>#692-R stopped digging for new p5:fid=<xsl:value-of select="$p5:fid"/> $p5:links.recurse_level.limit at <xsl:value-of select="$p5:links.recurse_level"/>; p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:comment>
-            </xsl:when>
-            <xsl:when test="number($p5:links.next.recurse_level) &gt; $p5:links.next.recurse_level.limit">
-                <xsl:message>#692-L stopped digging for new p5:fid=<xsl:value-of select="$p5:fid"/> $p5:links.recurse_level.limit at <xsl:value-of select="$p5:links.recurse_level"/>; p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:message>
-                <xsl:comment>#692-L stopped digging for new p5:fid=<xsl:value-of select="$p5:fid"/> $p5:links.recurse_level.limit at <xsl:value-of select="$p5:links.recurse_level"/>; p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:comment>
-            </xsl:when>
-            <xsl:otherwise>
-                
-                <xsl:comment>debug.current lower; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:comment>
-                <xsl:apply-templates mode="#current">
-                    <xsl:with-param name="p5:links.recurse_level" select="number($p5:links.recurse_level) + 1"/>
-                    <xsl:with-param name="p5:links.next.recurse_level" select="$p5:links.next.recurse_level"/>
-                    <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.merge($get_wfs_recurse_xsl:context.PRIMARYKEY,$p5:fid)"/>
-                    <xsl:with-param name="debug.last_wfs_request" select="$debug.last_wfs_request"/>
-                </xsl:apply-templates>
-                <xsl:comment>debug.current upper / debug.reffered lower; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:comment>
-                
-                <xsl:choose>
-                    <xsl:when test="$get_wfs_recurse_xsl:context.PRIMARYKEY//*[@fid = $p5:fid]">
-                        <xsl:message>#797 detected FUTURE LOOP  for fid=<xsl:value-of select="$p5:fid"/>  in match="wfs:FeatureCollection[@next </xsl:message>
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <xsl:variable name="get_wfs_recurse_xsl:wfs_response" select="doc($request_string)"/>
-                        <xsl:choose> 
-                            <xsl:when test="$get_wfs_recurse_xsl:wfs_response//gml:featureMember/*">
-                                <xsl:apply-templates mode="#current" select="$get_wfs_recurse_xsl:wfs_response">
-                                    <xsl:with-param name="p5:links.recurse_level" select="number($p5:links.recurse_level)"/> <!--  + 1 -->
-                                    <xsl:with-param name="p5:links.next.recurse_level" select="number($p5:links.next.recurse_level) + 1"/>
-                                    <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="get_wfs_recurse_xsl:context.nodes.merge($get_wfs_recurse_xsl:context.nodes,$get_wfs_recurse_xsl:wfs_response)"/>
-                                    <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="get_wfs_recurse_xsl:context.PRIMARYKEY.merge($get_wfs_recurse_xsl:context.PRIMARYKEY,$p5:fid)"/>
-                                    <xsl:with-param name="debug.last_wfs_request" select="$debug.last_wfs_request"/>
-                                </xsl:apply-templates>
-                            </xsl:when>
-                            <xsl:otherwise>
-                                
-                                <xsl:message>#498 not any childs</xsl:message>
-                            </xsl:otherwise>
-                        </xsl:choose>
-                    </xsl:otherwise>
-                </xsl:choose>
-                
-                    
-                <!--</debug_reffered>-->
-                <!--</debug.470>-->
-            </xsl:otherwise>
-        </xsl:choose>
-        
-    </xsl:template>
-    
-    <xsl:template match="wfs:FeatureCollection" mode="p5:links.evaluate" >
-        <xsl:param name="p5:links.recurse_level" select="1"/>
-        <xsl:param name="p5:links.next.recurse_level" select="1"/>
-        <xsl:param name="get_wfs_recurse_xsl:context.nodes" required="yes"/>
-        <xsl:param name="get_wfs_recurse_xsl:context.PRIMARYKEY" required="yes"/>
-        <xsl:param name="debug.last_wfs_request" required="yes"/>
-        <xsl:message>#538 match wfs:FeatureCollection $p5:links.recurse_level=<xsl:value-of select="$p5:links.recurse_level"/>; p5:links.next.recurse_level=<xsl:value-of select="$p5:links.next.recurse_level"/>;</xsl:message>
-        <xsl:apply-templates mode="#current">
-            <xsl:with-param name="p5:links.recurse_level" select="(number($p5:links.recurse_level) + 1)"/>
-            <xsl:with-param name="p5:links.next.recurse_level" select="$p5:links.next.recurse_level"/>
-            <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="$debug.last_wfs_request"/>
-        </xsl:apply-templates>
-    </xsl:template>
-    
-    <xsl:template match="gml:featureMember" mode="p5:links.evaluate">
-        <xsl:param name="p5:links.recurse_level" select="1"/>
-        <xsl:param name="p5:links.next.recurse_level" select="1"/>
-        <xsl:param name="get_wfs_recurse_xsl:context.nodes" required="yes"/>
-        <xsl:param name="get_wfs_recurse_xsl:context.PRIMARYKEY" required="yes"/>
-        <xsl:param name="debug.last_wfs_request" required="yes"/>
-        <xsl:apply-templates mode="#current">
-            <xsl:with-param name="p5:links.recurse_level" select="$p5:links.recurse_level"/>
-            <xsl:with-param name="p5:links.next.recurse_level" select="$p5:links.next.recurse_level"/>
-            <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="$debug.last_wfs_request"/>
-        </xsl:apply-templates>
-    </xsl:template>
-    
-    <!--<xsl:template match="RelatedFeature" mode="get_wfs_recurse_xsl:wfs_response">
-        <xsl:param name="get_wfs_recurse_xsl:wfs_response" required="yes"/>
-        <xsl:apply-templates mode="get_wfs_recurse_xsl:wfs_response">
-            <xsl:with-param name="get_wfs_recurse_xsl:wfs_response" select="$get_wfs_recurse_xsl:wfs_response"/>
-        </xsl:apply-templates>
-    </xsl:template>-->
-    
-    <!--<xsl:template match="simpleTypeMakeOgcFilter|RelatedFilter" mode="get_wfs_recurse_xsl:wfs_response"/>-->
-        
-    <!--<xsl:template match="*" mode="get_wfs_recurse_xsl:wfs_response">
-        <xsl:param name="get_wfs_recurse_xsl:wfs_response" required="yes"/>
-        <xsl:apply-templates mode="get_wfs_recurse_xsl:wfs_response_simpleType" select="$get_wfs_recurse_xsl:wfs_response"/>
-        <xsl:apply-templates mode="get_wfs_recurse_xsl:wfs_response_RelatedFeature">
-            <xsl:with-param name="get_wfs_recurse_xsl:wfs_response" select="$get_wfs_recurse_xsl:wfs_response"/>
-        </xsl:apply-templates>
-    </xsl:template>-->    
-    
-    
-    
-    
-    
-    <xsl:template mode="get_wfs_recurse_xsl:wfs_response_RelatedFeature" match="RelatedFeature">
-        <!--<xsl:param name="get_wfs_recurse_xsl:wfs_response" required="yes"/>-->
-        <xsl:param name="get_wfs_recurse_xsl:typeNameRealResource" select="@typeNameRealResource"/>
-        <xsl:param name="input_obj_with_xpath" required="yes"/>
-        <xsl:param name="resolveDepth.current" required="yes"/>
-        <!--<xsl:param name="xpath"  select="$xpath"/>-->
-        <!--<xsl:param name="xpath_value"  select="$xpath_value"/>-->
-        <!--<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="number($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)"/>-->
-        <xsl:variable name="get_wfs_recurse_xsl:simpleTypeMakeOgcFilter" select="simpleTypeMakeOgcFilter"/>
-        <xsl:variable name="get_wfs_recurse_xsl:RelatedFilter" select="RelatedFilter"/>
-        <xsl:variable name="OGC_Filter">
-            <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_dita"/>
-                <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
-               <!-- <xsl:with-param name="get_wfs_recurse_xsl:xpath_dita" select="$xpath_dita"/>
-                <xsl:with-param name="get_wfs_recurse_xsl:xpath_value_dita" select="$xpath_value_dita"/>-->
-            </xsl:call-template>
-        </xsl:variable>
-     
-        <!--<input_obj_with_xpath><xsl:copy-of select="$input_obj_with_xpath"/></input_obj_with_xpath>-->
-        <xsl:if test="number($debug) &gt; 4">
-            <xpath_dita>
-                <xsl:value-of select="$xpath_dita"/>/@xpath_value: <xsl:value-of select="@xpath_value"/>
-            </xpath_dita>
-            <xpath_value_dita>
-                <xsl:value-of select="$xpath_value_dita"></xsl:value-of>
-            </xpath_value_dita>
-            <!--  <get_wfs_recurse_xsl:simpleTypeMakeOgcFilter>
-                          <xsl:copy-of select="$get_wfs_recurse_xsl:simpleTypeMakeOgcFilter"/>
-                      </get_wfs_recurse_xsl:simpleTypeMakeOgcFilter>
-                      <Filter>
-                          <xsl:copy-of select="$OGC_Filter"/>
-                      </Filter>-->
-        </xsl:if>
-        <!--<xsl:variable name="request_string" select="concat('?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=',$get_wfs_recurse_xsl:typeNameRealResource,$OGC_Filter,'&amp;SRSNAME=EPSG:3003')"/>--> <!-- &amp;MAXFEATURES=15 -->
-        <xsl:variable name="request_string">
-            <xsl:call-template name="get_wfs_recurse_xsl:request_string">
-                <xsl:with-param name="OGC_Filter" select="$OGC_Filter"/>
-                <xsl:with-param name="REQUEST.TYPE" select="'GetFeature'"/>
-                <xsl:with-param name="REQUEST.TYPENAME" select="$get_wfs_recurse_xsl:typeNameRealResource"/>
-            </xsl:call-template>
-        </xsl:variable>
-        <!--<xsl:variable name="url_string" select="concat($protocol,$username,':',$username.pass,'@',$api,'/',$targetNamespace_DEFAULTS_prefix,'/',$request_string)"/>-->
-        <xsl:variable name="get_wfs_recurse_xsl:wfs_response" select="doc($request_string)"/>
-        <xsl:if test="number($debug) &gt; 5">
-            <wfs_response>
-                <request>Retrieving <xsl:value-of select="$request_string"/></request>
-                <oryg>https://                     biuro.biall-net.pl/SE/version-git/wfs-data.php/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=p5_default_db:CRM_PROCES&amp;SRSNAME=EPSG:3003&amp;MAXFEATURES=15</oryg>
-                <test>https://a.binder:@biuro.biall-net.pl/SE/version-git/wfs-data.php/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=p5_default_db:PROCES_INIT&amp;SRSNAME=EPSG:3003&amp;MAXFEATURES=15</test>
-                <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response//gml:featureMember[1]"/>
-            </wfs_response>
-        </xsl:if>
-        <xsl:apply-templates mode="after_first_ant_assing_vars" select="." >
-            
-            <xsl:with-param name="get_wfs_recurse_xsl:wfs_response" select="$get_wfs_recurse_xsl:wfs_response"/>
-            <xsl:with-param name="resolveDepth.current" select="$resolveDepth.current"/>
-        </xsl:apply-templates>
-        
-    </xsl:template>
-    
-    
-    <xsl:template mode="get_wfs_recurse_xsl:wfs_response_RelatedFeatureLoop" match="RelatedFeature">
-        <!--<xsl:param name="get_wfs_recurse_xsl:wfs_response" required="yes"/>-->
-        <xsl:param name="get_wfs_recurse_xsl:typeNameRealResource" select="@typeNameRealResource"/>
-        <xsl:param name="input_obj_with_xpath" required="yes"/>
-        <xsl:param name="xpath"  select="$xpath"/>
-        <xsl:param name="xpath_value"  select="$xpath_value"/>
-        <xsl:param name="resolveDepth.current" required="yes"/>
-        <!--<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: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)"/>-->
-        <xsl:variable name="get_wfs_recurse_xsl:simpleTypeMakeOgcFilter" select="simpleTypeMakeOgcFilter"/>
-        <xsl:variable name="get_wfs_recurse_xsl:RelatedFilter" select="RelatedFilter"/>
-        <xsl:variable name="OGC_Filter">
-            <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_dita"/>
-                <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
-                
-             <!--   <xsl:with-param name="get_wfs_recurse_xsl:xpath_dita" select="$xpath_dita"/>
-                <xsl:with-param name="get_wfs_recurse_xsl:xpath_value_dita" select="$xpath_value_dita"/>-->
-            </xsl:call-template>
-        </xsl:variable>
-        
-        <!--<input_obj_with_xpath><xsl:copy-of select="$input_obj_with_xpath"/></input_obj_with_xpath>-->
-        <xsl:if test="number($debug) &gt; 4">
-            <debug>
-                <xsl:attribute name="typeNameRealResource" select="@typeNameRealResource"/>
-                <xsl:attribute name="typeName" select="@typeName"/>
-              <xpath_dita>
-                  <xsl:value-of select="$xpath_dita"/>/@xpath_value: <xsl:value-of select="@xpath_value"/>
-              </xpath_dita>
-              <xpath_value_dita>
-                  <xsl:value-of select="$xpath_value_dita"></xsl:value-of>
-              </xpath_value_dita>
-            </debug>
-        </xsl:if>
-        <!--  <get_wfs_recurse_xsl:simpleTypeMakeOgcFilter>
-                      <xsl:copy-of select="$get_wfs_recurse_xsl:simpleTypeMakeOgcFilter"/>
-                  </get_wfs_recurse_xsl:simpleTypeMakeOgcFilter>
-                  <Filter>
-                      <xsl:copy-of select="$OGC_Filter"/>
-                  </Filter>-->
-        
-        <!--<xsl:variable name="request_string" select="concat('?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=',$get_wfs_recurse_xsl:typeNameRealResource,$OGC_Filter,'&amp;SRSNAME=EPSG:3003')"/>--> <!-- &amp;MAXFEATURES=15 -->
-        <xsl:variable name="request_string">
-            <xsl:call-template name="get_wfs_recurse_xsl:request_string">
-                <xsl:with-param name="OGC_Filter" select="$OGC_Filter"/>
-                <xsl:with-param name="REQUEST.TYPE" select="'GetFeature'"/>
-                <xsl:with-param name="REQUEST.TYPENAME" select="$get_wfs_recurse_xsl:typeNameRealResource"/>
-            </xsl:call-template>
-        </xsl:variable>
-        <!--<xsl:variable name="url_string" select="concat($protocol,$username,':',$username.pass,'@',$api,'/',$targetNamespace_DEFAULTS_prefix,'/',$request_string)"/>-->
-        <xsl:variable name="get_wfs_recurse_xsl:wfs_response" select="doc($request_string)"/>
-        <xsl:if test="number($debug) &gt; 4">
-            <wfs_response>
-                <request>Retrieving <xsl:value-of select="$request_string"/></request>
-                <oryg>https://                     biuro.biall-net.pl/SE/version-git/wfs-data.php/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=p5_default_db:CRM_PROCES&amp;SRSNAME=EPSG:3003&amp;MAXFEATURES=15</oryg>
-                <test>https://a.binder:@biuro.biall-net.pl/SE/version-git/wfs-data.php/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=p5_default_db:PROCES_INIT&amp;SRSNAME=EPSG:3003&amp;MAXFEATURES=15</test>
-               <!-- <debug_child_loop>-->
-                    <!--<xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response"/>-->
-                <!--</debug_child_loop>-->
-                <!--<xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response"/>-->
-            </wfs_response>
-        </xsl:if>
-        <xsl:apply-templates mode="after_first_ant_assing_vars" select="." >
-            <xsl:with-param name="get_wfs_recurse_xsl:wfs_response" select="$get_wfs_recurse_xsl:wfs_response"/>
-            <xsl:with-param name="resolveDepth.current" select="$resolveDepth.current"/>
-        </xsl:apply-templates>
-    </xsl:template>
-    
-    
-    <xsl:template mode="get_wfs_recurse_xsl:wfs_response_simpleType" match="*">
-        <xsl:copy-of select="."/>
-    </xsl:template>
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    <xsl:template match="wfs:FeatureCollection">
-        <xsl:apply-templates/>
-    </xsl:template>
-    
-    <xsl:template  match="gml:featureMember">
-        <xsl:apply-templates mode="gml:featureMember"/>
-    </xsl:template>
-    
-    <xsl:template match="*" mode="gml:featureMember">
-         <!-- TODO parse from prefx requested type -->
-    </xsl:template>
-    
-    
-    
-    
-    
-    
-    <!-- xpath -->
-    
-    <xsl:template match="text()|comment()" mode="after_first_ant_assing_vars"/>
-      
-      
-      <xsl:template match="RelatedFeature" mode="after_first_ant_assing_vars">
-          <xsl:param name="loop_xpath" />
-          <xsl:param name="get_wfs_recurse_xsl:wfs_response"  required="yes"/>
-          <xsl:param name="resolveDepth.current" required="yes"/>
-        <!--<RelatedFeatureRoot>-->
-            
-        <!-- first assign xpath to features from  -->
-        <xsl:variable name="wfs_output_nodes" select="$get_wfs_recurse_xsl:wfs_response"/>
-        <xsl:variable name="current_RelatedFeature" select="*"/>
-        <xsl:variable name="xml_id" select="@xml_id"/>
-        <xsl:variable name="feature_pos_parent" select="@feature_pos"/>
-        
-          <xsl:if test="number($debug) &gt; 2"><xsl:message>
-                     {+}{+}{+}{+}{+}{+}{+}{+}{+}{+} #354 count($wfs_output_nodes//gml:featureMember) <xsl:value-of select="count($wfs_output_nodes//gml:featureMember)"/></xsl:message></xsl:if>
-          <!-- 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">
-                <!--<wfs_record>
-                    <xsl:copy-of select="."/>
-                </wfs_record>-->
-                <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:variable name="input_obj_fid" select="*"/> <!-- dla wykrycia @fid -->
-                <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:with-param name="feature_pos_parent" select="$feature_pos_parent"/> <!-- @2017-04 byly nadpisywane informacje - trzeba dorzucic jeszcze $feature_pos_parent w nazwie przetwarzania -->
-                    <xsl:with-param name="input_obj_fid" select="$input_obj_fid"/>
-                    <xsl:with-param name="resolveDepth.current" select="$resolveDepth.current"/>
-                </xsl:apply-templates>
-                <!-- cache tasks ? -->
-            </xsl:for-each>
-        <!--</RelatedFeatureRoot>-->
-    </xsl:template>
-    
-    
-    
-    
-    
-    <!--<xsl:template match="wfs:FeatureCollection|gml:featureMember" mode="after_first_ant_assing_xpath">
-        <xsl:apply-templates mode="after_first_ant_assing_xpath"/>
-    </xsl:template>-->
-    
-    
-    <xsl:template mode="after_first_ant_assing_xpath" match="*">
-        <xsl:param name="curr_xpath"/>
-        <xsl:param name="loop_xpath"/>
-        <xsl:choose>
-            <xsl:when test="name()=$typeName">
-                <xsl:apply-templates mode="after_first_ant_assing_xpath">
-                    <xsl:with-param name="curr_xpath" select="$curr_xpath"/>
-                    <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
-                </xsl:apply-templates>
-            </xsl:when>
-            <xsl:otherwise>
-                <xsl:variable name="curr_xpath_tmpl">
-                    <xsl:choose>
-                        <xsl:when test="$curr_xpath=''">
-                            <xsl:value-of select="local-name()"/> <!-- bylo local-name() - trzeba dorzucic xpath przechodzacy aby budowal sie w kwestii  -->
-                        </xsl:when>
-                        <xsl:otherwise>
-                            <xsl:value-of select="concat($curr_xpath,'/',local-name())"/>
-                        </xsl:otherwise>
-                    </xsl:choose>
-                </xsl:variable>
-                <!--<xsl:variable name="curr_xpath_tmpl" select="'asdf'"/>-->
-                <!--<xsl:element name="{name()}" >-->
-                
-                <xsl:choose>
-                    <xsl:when test="contains(name(),'gml')">
-                        <xsl:element name="{local-name()}">
-                            <xsl:attribute name="xpath" select="$curr_xpath_tmpl"/>
-                            <xsl:for-each select="@*">
-                                <xsl:choose>
-                                    <xsl:when test="name()='fid'"/>
-                                    <xsl:otherwise><xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute></xsl:otherwise>
-                                </xsl:choose>
-                            </xsl:for-each>
-                            <xsl:value-of select="text()"/>
-                            <xsl:apply-templates mode="after_first_ant_assing_xpath">
-                                <xsl:with-param name="curr_xpath" select="$curr_xpath_tmpl"/>
-                            </xsl:apply-templates>
-                        </xsl:element>
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <xsl:copy>
-                            <xsl:attribute name="xpath" select="$curr_xpath_tmpl"/>
-                            <xsl:for-each select="@*">
-                                <xsl:choose>
-                                    <xsl:when test="name()='fid'"/>
-                                    <xsl:otherwise><xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute></xsl:otherwise>
-                                </xsl:choose>
-                            </xsl:for-each>
-                            <xsl:value-of select="text()"/>
-                            <xsl:apply-templates mode="after_first_ant_assing_xpath">
-                                <xsl:with-param name="curr_xpath" select="$curr_xpath_tmpl"/>
-                            </xsl:apply-templates>
-                        </xsl:copy>
-                    </xsl:otherwise>
-                </xsl:choose>
-                
-                
-                <!--</xsl:element>-->
-            </xsl:otherwise>
-        </xsl:choose>
-    </xsl:template>
-    
-    <xsl:template match="text()" mode="after_first_ant_assing_xpath"/>
-    
-    
-    <xsl:template  match="simpleTypeMakeOgcFilter" mode="after_first_ant_assing_vars_childs">
-        <xsl:if test="number($debug) &gt; 2"><xsl:message>#621 bypassing simpleTypeMakeOgcFilter in after_first_ant_assing_vars_childs</xsl:message></xsl:if>
-    </xsl:template>
-    
-    
-    <!-- przetwarzanie kolejne w celu podstawienia wartosci i wystawienia build dla kolejnych wezlow - problem z obsluga rownorzednie zagniezdzonych wezlow poprzez inne wezly -->
-    <xsl:template  match="*" mode="after_first_ant_assing_vars_childs">
-        <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:param name="feature_pos_parent"  required="yes"/>
-        <xsl:param name="input_obj_fid" required="no"/>
-        <xsl:param name="resolveDepth.current" required="yes"/>
-        <xsl:for-each select=".">
-            <xsl:choose>
-              
-                <xsl:when test="1=2"/>
-                <xsl:otherwise>
-                    <xsl:element name="{local-name()}">
-                        
-                        <!--<xsl:if test="$input_obj_fid">
-                             <!-\-<xsl:attribute name="input_obj_fid_name" select="$input_obj_fid/name()"/>-\->
-                             <xsl:attribute name="fid" select="$input_obj_fid/@fid"/>
-                        </xsl:if>-->
-                        <!--<xsl:copy-of select="namespace::node()"/>-->
-                        <xsl:for-each select="@*">
-                            <xsl:choose>
-                                <xsl:when test="name()='fid'"/>
-                                <xsl:when test="name()='xml_id'"/>
-                                <xsl:when test="name()='format'"/>
-                                <xsl:when test="name()='xpath_token_filter'"/>
-                                <xsl:when test="name()='xpath_token'"/>
-                                <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()"/>-->
-                                    <!--<xsl:value-of select="$parent_obj//node()[local-name()=$xpath]/text()"/>-->
-                                    <!--V:<xsl:value-of select="$xpath"/>-->
-                                </xsl:when>
-                                <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
-                            </xsl:choose>
-                        </xsl:for-each>
-                        <xsl:choose>
-                            <xsl:when test="@xpath">
-                                <!--<xsl:variable name="enter_to_ph">-->
-                                    <xsl:choose>
-                                        <xsl:when test="@xpath_token_filter and @xpath_token ">
-                                            <!-- implementacja filtra dla czegos oddzielonego parametrem -->
-                                            <xsl:variable name="xpath_token_filter" select="tokenize($input_obj_with_xpath/node()[local-name()=current()/@xpath],@xpath_token_filter)"/>
-                                            <xsl:for-each select=" tokenize(@xpath_token,' ')">
-                                                <xsl:variable name="xpath_token" select="number(.)"/>
-                                                <xsl:copy-of select="$xpath_token_filter[$xpath_token]"></xsl:copy-of>
-                                            </xsl:for-each>
-                                        </xsl:when>
-                                        <xsl:when test="$input_obj_with_xpath/node()[local-name()=current()/@xpath]/*">
-                                            <xsl:copy-of select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]/*"/>
-                                        </xsl:when>
-                                        <xsl:otherwise>
-                                            <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>-->
-                                <!--<xsl:copy-of select="$enter_to_ph"/>-->
-                            </xsl:when>
-                            <xsl:otherwise><xsl:copy-of select="text()"></xsl:copy-of></xsl:otherwise>
-                        </xsl:choose>
-                        <!--<xsl:comment>#1938 value of text()</xsl:comment>-->
-                        <!--XXXX <xsl:value-of select="text()"/>-->
-                        <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_parent"/>
-                            <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
-                            <xsl:with-param name="feature_pos" select="$feature_pos"/>
-                            <xsl:with-param name="feature_pos_parent" select="$feature_pos_parent"/>
-                            <xsl:with-param name="input_obj_fid" select="$input_obj_fid"/>
-                            <xsl:with-param name="resolveDepth.current" select="$resolveDepth.current"/>
-                        </xsl:apply-templates>
-                    </xsl:element>
-                </xsl:otherwise>
-            </xsl:choose>
-        </xsl:for-each>
-    </xsl:template>
-    <xsl:template  match="RelatedFeature" mode="after_first_ant_assing_vars_childs">
-        <xsl:if test="number($debug) &gt; 2"><xsl:message>#1638 ignored @maxOccurs=<xsl:value-of select="@system_cache__appinfo:maxOccurs"/>; @typeName=<xsl:value-of select="@typeName"/>; @xml_id=<xsl:value-of select="@xml_id"/>;  </xsl:message></xsl:if>
-    </xsl:template> <!-- to disable ignored maxOccurs=0 -->
-    
-    <xsl:template  match="RelatedFeature[not(@system_cache__appinfo:maxOccurs='0') or not($ignore_maxOccurs_0)]" mode="after_first_ant_assing_vars_childs">
-        <xsl:param name="input_obj_with_xpath" required="yes"/>
-        <xsl:param name="xml_id_parent" required="yes"/>
-        <xsl:param name="loop_xpath"  />
-        <xsl:param name="feature_pos"   required="yes"/>
-        <xsl:param name="feature_pos_parent" required="yes"/>
-        <xsl:param name="input_obj_fid" required="yes"/>
-        <xsl:param name="xpath_query"/> <!-- + added test -->
-        <xsl:param name="resolveDepth.current" required="yes"/>
-        <xsl:if test="number($debug) &gt; 2"><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></xsl:if>
-        <!-- 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"/>
-        <xsl:variable name="loop_xpath" select="concat($loop_xpath,'/',$xml_id,'.',$feature_pos)"/> <!-- loop path too long ,'.',$featureID_name -->
-        <!--<xsl:variable name="loop_xpath_save" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>--> <!-- tutaj zapisal sie build z wezla z parent -->
-        <!--<debug_358_RelatedFeature>
-            <xsl:copy-of select="$input_obj_with_xpath"/>
-        </debug_358_RelatedFeature>-->
-        <!--<xsl:variable name="feature_pos">
-            <xsl:choose>
-                <xsl:when test="$feature_pos=1"/>
-                <xsl:otherwise><xsl:value-of select="$feature_pos"/></xsl:otherwise>
-            </xsl:choose>
-        </xsl:variable>-->
-        <xsl:variable name="test_xpath_query">
-            <xsl:call-template name="test_xpath_query">
-                <xsl:with-param name="featureID_name_dita" select="$featureID_name"/>
-                <xsl:with-param name="ignore_maxOccurs_0" select="$ignore_maxOccurs_0"/>
-                <xsl:with-param name="system_cache__appinfo:maxOccurs" select="@system_cache__appinfo:maxOccurs"/>
-                <xsl:with-param name="xpath_query" select="$xpath_query"/>
-            </xsl:call-template>
-        </xsl:variable>
-        
-        <xsl:choose>
-            <xsl:when test="$test_xpath_query='1'">
-                <xsl:if test="number($debug) &gt; 2"><xsl:message>[][][][][]\/\/\/\/\/\/\/\/\/\/\/ #1540  jest okazja do zrobienia bilda $feature_pos_parent = <xsl:value-of select="$feature_pos_parent"/> ; $feature_pos=<xsl:value-of select="$feature_pos"/> $xml_id_parent=<xsl:value-of select="$xml_id_parent"/>; $xml_id=<xsl:value-of select="$xml_id"/>;  match=RelatedFeature mode=after_first_ant_assing_vars_childs  </xsl:message></xsl:if>
-                <xsl:comment>#527 there we exec child dig</xsl:comment>
-              <!--  <xsl:element name="RelatedFeature">
-                    <xsl:copy-of select="@*"/>
-                    <xsl:attribute name="featureID_name" select="$featureID_name"/>
-                    <xsl:attribute name="loop_xpath" select="$loop_xpath"/>
-                    <xsl:attribute name="feature_pos" select="$feature_pos"/>
-                    <xsl:attribute name="feature_pos_parent" select="$feature_pos_parent"/>
-                    <xsl:attribute name="fid" select="$input_obj_fid/@fid"/>-->
-                    <xsl:apply-templates mode="get_wfs_recurse_xsl:wfs_response_RelatedFeature" select=".">
-                        <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
-                        <xsl:with-param name="resolveDepth.current" select="$resolveDepth.current"/>
-                    </xsl:apply-templates>
-                <!--</xsl:element>-->
-            </xsl:when>
-            <xsl:otherwise>
-                <xsl:if test="number($debug) &gt; 2"><xsl:message terminate="no">#389b
-                    #
-                    #
-                    #
-                    BYPASSED BY $test_xpath_query=<xsl:value-of select="$test_xpath_query"/>;  jest okazja do zrobienia bilda $feature_pos=<xsl:value-of select="$feature_pos"/> $xml_id_parent=<xsl:value-of select="$xml_id_parent"/>; $xml_id=<xsl:value-of select="$xml_id"/>;  result-document=<xsl:value-of select="concat($uuid,'.build_',$loop_xpath,'.xml')"/> match=RelatedFeature mode=after_first_ant_assing_vars_childs 
-                    #
-                    #</xsl:message></xsl:if>
-            </xsl:otherwise>
-        </xsl:choose>
-        
-    </xsl:template>
-    
-    <xsl:template  match="RelatedFeatureLoop" mode="after_first_ant_assing_vars_childs">
-        <xsl:if test="number($debug) &gt; 2"><xsl:message>#1718 ignored @maxOccurs=<xsl:value-of select="@system_cache__appinfo:maxOccurs"/>; @typeName=<xsl:value-of select="@typeName"/>; @xml_id=<xsl:value-of select="@xml_id"/>; </xsl:message></xsl:if>
-    </xsl:template>
-    <xsl:template  match="RelatedFeatureLoop[not(@system_cache__appinfo:maxOccurs='0') or not($ignore_maxOccurs_0)]" mode="after_first_ant_assing_vars_childs">
-        <xsl:param name="input_obj_with_xpath" required="yes"/>
-        <xsl:param name="xml_id_parent" required="yes"/>
-        <xsl:param name="loop_xpath"  />
-        <xsl:param name="feature_pos"   required="yes"/>
-        <xsl:param name="feature_pos_parent" required="yes"/>
-        <xsl:param name="input_obj_fid" required="yes"/>
-        <xsl:param name="xpath_query"/> <!-- + added test -->
-        <xsl:param name="resolveDepth.current" required="yes"/>
-        <xsl:if test="number($debug) &gt; 2"><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></xsl:if>
-        <!-- 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"/>
-        <xsl:variable name="loop_xpath" select="concat($loop_xpath,'/',$xml_id,'.',$feature_pos)"/> <!-- loop path too long ,'.',$featureID_name -->
-        <!--<xsl:variable name="loop_xpath_save" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>--> <!-- tutaj zapisal sie build z wezla z parent -->
-        <!--<debug_358_RelatedFeature>
-            <xsl:copy-of select="$input_obj_with_xpath"/>
-        </debug_358_RelatedFeature>-->
-        <!--<xsl:variable name="feature_pos">
-            <xsl:choose>
-                <xsl:when test="$feature_pos=1"/>
-                <xsl:otherwise><xsl:value-of select="$feature_pos"/></xsl:otherwise>
-            </xsl:choose>
-        </xsl:variable>-->
-        <xsl:variable name="test_xpath_query">
-            <xsl:call-template name="test_xpath_query">
-                <xsl:with-param name="featureID_name_dita" select="$featureID_name"/>
-                <xsl:with-param name="ignore_maxOccurs_0" select="$ignore_maxOccurs_0"/>
-                <xsl:with-param name="system_cache__appinfo:maxOccurs" select="@system_cache__appinfo:maxOccurs"/>
-                <xsl:with-param name="xpath_query" select="$xpath_query"/>
-            </xsl:call-template>
-        </xsl:variable>
-        <xsl:choose>
-            <xsl:when test="$resolveDepth.current &gt; $resolveDepth">
-                <xsl:message>#1722 exceeded $resolveDepth.current &gt; $resolveDepth = <xsl:value-of select="$resolveDepth.current"/></xsl:message>
-            </xsl:when>
-            <xsl:when test="$test_xpath_query='1'">
-                <xsl:if test="number($debug) &gt; 2"><xsl:message>[][][][][]\/\/\/\/\/\/\/\/\/\/\/ #1540  jest okazja do zrobienia bilda $feature_pos_parent = <xsl:value-of select="$feature_pos_parent"/> ; $feature_pos=<xsl:value-of select="$feature_pos"/> $xml_id_parent=<xsl:value-of select="$xml_id_parent"/>; $xml_id=<xsl:value-of select="$xml_id"/>;  match=RelatedFeature mode=after_first_ant_assing_vars_childs  </xsl:message></xsl:if>
-                <xsl:comment>#527 there we exec child dig</xsl:comment>
-               <!-- <xsl:element name="RelatedFeature">
-                    <xsl:copy-of select="@*"/>
-                    <xsl:attribute name="featureID_name" select="$featureID_name"/>
-                    <xsl:attribute name="loop_xpath" select="$loop_xpath"/>
-                    <xsl:attribute name="feature_pos" select="$feature_pos"/>
-                    <xsl:attribute name="feature_pos_parent" select="$feature_pos_parent"/>
-                    <xsl:attribute name="fid" select="$input_obj_fid/@fid"/>-->
-                    <xsl:comment>#710 opening new Loop recurse instance for <xsl:value-of select="@typeName"/></xsl:comment>
-                    <xsl:message>#710 resolveDepth.current = <xsl:value-of select="$resolveDepth.current"/>; opening new Loop recurse instance for <xsl:value-of select="@typeName"/></xsl:message>
-                    <xsl:apply-templates mode="get_wfs_recurse_xsl:wfs_response_RelatedFeatureLoop" select="get_wfs_recurse_xsl:GetsimpleSchema(@typeName)">
-                        <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
-                        <xsl:with-param name="xpath" select="@xpath"/>
-                        <xsl:with-param name="xpath_value" select="@xpath_value"/>
-                        <xsl:with-param name="resolveDepth.current" select="$resolveDepth.current + 1"/>
-                    </xsl:apply-templates>
-                <!--</xsl:element>-->
-            </xsl:when>
-            <xsl:otherwise>
-                <xsl:if test="number($debug) &gt; 2"><xsl:message terminate="yes">#389b
-                    #
-                    #
-                    #
-                    BYPASSED BY $test_xpath_query=<xsl:value-of select="$test_xpath_query"/>;  jest okazja do zrobienia bilda $feature_pos=<xsl:value-of select="$feature_pos"/> $xml_id_parent=<xsl:value-of select="$xml_id_parent"/>; $xml_id=<xsl:value-of select="$xml_id"/>;  result-document=<xsl:value-of select="concat($uuid,'.build_',$loop_xpath,'.xml')"/> match=RelatedFeature mode=after_first_ant_assing_vars_childs 
-                    #
-                    #</xsl:message></xsl:if>
-            </xsl:otherwise>
-        </xsl:choose>
-        
-    </xsl:template>
-    
-    <xsl:template match="text()" mode="after_first_ant_assing_vars_childs"/>
-    <xsl:template match="comment()" mode="after_first_ant_assing_vars_childs"/>
-    <!-- pozbieranie do kupy wszystkich xmli i zlozenie dity -->
-    
-    <xsl:template name="test_xpath_query">
-        <!-- to verify if retrieve some node based on user requested tree limit filter -->
-        <xsl:param name="ignore_maxOccurs_0" required="yes"/>
-        <xsl:param name="xpath_query" required="yes"/>
-        <xsl:param name="featureID_name_dita" required="yes"/>
-        <xsl:param name="system_cache__appinfo:maxOccurs" required="yes"/>
-        <xsl:if test="number($debug) &gt; 2"><xsl:message>#1290 $system_cache__appinfo:maxOccurs=<xsl:value-of select="$system_cache__appinfo:maxOccurs"/>; $featureID_name_dita=<xsl:value-of select="$featureID_name_dita"/>; $xpath_query=<xsl:value-of select="$xpath_query"/>; </xsl:message></xsl:if>
-        <xsl:if test="$ignore_maxOccurs_0"><xsl:if test="number($debug) &gt; 2"><xsl:message terminate="no">#1344 test igrnore is true()=<xsl:value-of select="$ignore_maxOccurs_0"/>;</xsl:message></xsl:if></xsl:if>
-        <xsl:variable name="TestMaxOccurs">
-            <xsl:choose>
-                <xsl:when test="$system_cache__appinfo:maxOccurs='0' and $ignore_maxOccurs_0"></xsl:when>
-                <xsl:otherwise><xsl:value-of select="1"/></xsl:otherwise>
-            </xsl:choose>
-        </xsl:variable>
-        <xsl:value-of select="$TestMaxOccurs"/>
-    </xsl:template>
-    
-    <xsl:template match="RelatedFeatureRoot" mode="anonimize_for_devel">
-        <wfs:FeatureCollection>
-            <xsl:apply-templates mode="anonimize_for_devel.featureMember" />
-        </wfs:FeatureCollection>
-    </xsl:template>
-    
-    
-    <xsl:template match="*" mode="anonimize_for_devel.featureMember">
-        <gml:featureMember>
-            <xsl:copy copy-namespaces="no">
-                <xsl:copy-of select="@*"/>
-                <xsl:apply-templates mode="anonimize_for_devel.child"/>
-            </xsl:copy>
-        </gml:featureMember>
-    </xsl:template>
-    
-    
-    
-    <xsl:template match="p5:links" mode="anonimize_for_devel.child"/>
-    <xsl:template match="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI[ parent::default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA]|default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY[ parent::default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA]" priority="9" mode="anonimize_for_devel.child">
-        <xsl:message>#1600 debug hidden name()=<xsl:value-of select="name()"/>;</xsl:message>
-    </xsl:template>
-    
-    
-    <xsl:template match="get_wfs_recurse_xsl:context.PRIMARYKEY|get_wfs_recurse_xsl:context.nodes" mode="anonimize_for_devel.child"/>
-    <xsl:template match="text()" mode="anonimize_for_devel.child"/>
-    
-    <xsl:template match="comment()" mode="anonimize_for_devel.child">
-        <xsl:copy-of select="."/>
-    </xsl:template>
-    
-    <xsl:template match="*" mode="anonimize_for_devel.child">
-        <xsl:copy copy-namespaces="no">
-            <xsl:copy-of select="@*"/>
-            <xsl:copy-of select="text()"/>
-            <xsl:apply-templates mode="#current"/>
-        </xsl:copy>
-    </xsl:template>
-    
-    <xsl:template match="*[ local-name()='krs' or local-name()='pesel' or local-name()='nazwa' or local-name()='nazwisko' or local-name()='NIP' or local-name()='REGON' or local-name()='KRS' or local-name()='Pelna_nazwa_kontrahenta' or 
-        local-name()='Ulica' or local-name()='Miejscowosc' or local-name()='Kod_pocztowy' or local-name()='TERYT_SYM_UL' or local-name()='TERYT_SYM'  or local-name()='Numer_budynku']" mode="anonimize_for_devel.child">
-        <xsl:copy copy-namespaces="no">
-            <xsl:copy-of select="@*"/>
-            <xsl:value-of select="concat(substring(text(),1,2),'*****',string-length(text()))"/>
-        </xsl:copy>
-    </xsl:template>
-    
-    
-    
-    
     
     
 </xsl:stylesheet>