get_wfs_recurse_xsl.xsl 115 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  4. xmlns:wfs="http://www.opengis.net/wfs"
  5. xmlns:gml="http://www.opengis.net/gml"
  6. xmlns:ogc="http://www.opengis.net/ogc"
  7. xmlns:p5="https://biuro.biall-net.pl/wfs"
  8. xmlns:system_cache__resources_tree_generate_xsl_required_occurs_raport="http://biuro.biall-net.pl/xmlschema_procesy5/system_cache/resources_tree_generate_xsl_require_occurs_raport"
  9. xmlns:get_wfs_recurse_xsl="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/get_wfs_recurse_xsl.xsd"
  10. xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
  11. xmlns:default_db="https://biuro.biall-net.pl/wfs/default_db"
  12. xmlns:default_objects="https://biuro.biall-net.pl/wfs/default_objects"
  13. xmlns:xlink="http://www.w3.org/1999/xlink"
  14. xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA"
  15. xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row"
  16. xmlns:default_db__x3A__BI_audit_ENERGA_PRACOWNICY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_PRACOWNICY"
  17. xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI"
  18. exclude-result-prefixes="xs"
  19. version="2.0">
  20. <!-- TESTING for recurse get WFS using xsd schemas and/or retrieved xlinks -->
  21. <xsl:import href="system_cache__appinfo/escape_functions.xsl"/>
  22. <xsl:output indent="yes"/>
  23. <xsl:strip-space elements="*"/>
  24. <xsl:param name="typeName" select="'p5_default_db:PROCES_INIT'"/>
  25. <xsl:param name="typeName.object" select="'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA'"/>
  26. <xsl:param name="xpath" select="'ID'"/>
  27. <xsl:param name="xpath_value" select="'994'"/>
  28. <xsl:param name="uuid" select="'PROCES_INIT_PID_994_ALL_test'"/>
  29. <xsl:param name="MAXFEATURES" select="1000"/>
  30. <!--<xsl:param name="procesy5_system_schema_file" required="yes"/>-->
  31. <!--<xsl:param name="vrtfNamespaces_file" required="yes"/>-->
  32. <xsl:param name="username" select="'a.binder'"/>
  33. <xsl:param name="username.pass" required="yes"/>
  34. <xsl:param name="php_session_id_ok.string"/>
  35. <xsl:param name="simpleSchema_dir" required="yes"/>
  36. <xsl:param name="targetNamespace_DEFAULTS_prefix" select="'default_db'"/> <!-- TODO should be detected -->
  37. <xsl:param name="debug" select="0"/>
  38. <xsl:param name="api" select="'biuro.biall-net.pl/SE/version-git/wfs-data.php'"/>
  39. <xsl:param name="protocol" select="'https://'"/>
  40. <!--<xsl:variable name="vrtfNamespaces" select="doc($vrtfNamespaces_file)"/>
  41. <xsl:variable name="procesy5_system_schema" select="doc($procesy5_system_schema_file)"/>
  42. -->
  43. <xsl:param name="ignore_maxOccurs_0" select="'1'"/>
  44. <xsl:param name="api_recurse"/> <!-- to use api resolveDepth -->
  45. <xsl:param name="resolveDepth" select="5"/>
  46. <xsl:param name="p5:links.recurse_level.limit" select="8"/>
  47. <xsl:param name="p5:links.next.recurse_level.limit" select="10"/>
  48. <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 -->
  49. <xsl:function name="get_wfs_recurse_xsl:GetsimpleSchema">
  50. <xsl:param name="typeNameRealResource"/>
  51. <xsl:variable name="featureID_name_dita">
  52. <xsl:choose>
  53. <xsl:when test=" substring-before(system_cache__appinfo:translate_object_escaped_prefix_from_string(substring-before($typeNameRealResource,':')),':')">
  54. <xsl:value-of select="$typeNameRealResource"/>
  55. </xsl:when>
  56. <xsl:when test=" substring-after($typeNameRealResource,':')">
  57. <xsl:value-of select="substring-after($typeNameRealResource,':')"/>
  58. </xsl:when>
  59. <xsl:otherwise><xsl:value-of select="$typeNameRealResource"/></xsl:otherwise>
  60. </xsl:choose>
  61. </xsl:variable>
  62. <xsl:variable name="simpleSchemaFile">
  63. <xsl:choose>
  64. <xsl:when test=" substring-before(system_cache__appinfo:translate_object_escaped_prefix_from_string(substring-before($typeNameRealResource,':')),':')">
  65. <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>
  66. <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')"/>
  67. </xsl:when>
  68. <xsl:otherwise><xsl:value-of select="concat($simpleSchema_dir,'/',$targetNamespace_DEFAULTS_prefix,'/',$featureID_name_dita,'.xml')"/></xsl:otherwise>
  69. </xsl:choose>
  70. </xsl:variable>
  71. <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>
  72. <xsl:if test="not( substring-before(system_cache__appinfo:translate_object_escaped_prefix_from_string(substring-before($typeNameRealResource,':')),':'))">
  73. <xsl:copy-of select="doc($simpleSchemaFile)"/>
  74. </xsl:if>
  75. </xsl:function>
  76. <xsl:function name="get_wfs_recurse_xsl:typeNameRealResource">
  77. <xsl:param name="get_wfs_recurse_xsl:GetsimpleSchema"/>
  78. <xsl:choose>
  79. <xsl:when test="$api_recurse">
  80. <!-- default_db:CRM_LISTA_ZASOBOW -->
  81. <xsl:choose>
  82. <xsl:when test="$typeName.object">
  83. <xsl:value-of select="$typeName.object"/>
  84. </xsl:when>
  85. <xsl:otherwise>
  86. <xsl:variable name="typeName.local" select="$get_wfs_recurse_xsl:GetsimpleSchema/RelatedFeature/@typeName"/>
  87. <xsl:value-of select="concat( system_cache__appinfo:escape_object_prefix_to_string($typeName),':', system_cache__appinfo:clean_object_prefix($typeName))"/>
  88. </xsl:otherwise>
  89. </xsl:choose>
  90. </xsl:when>
  91. <xsl:otherwise>
  92. <xsl:value-of select="$get_wfs_recurse_xsl:GetsimpleSchema/RelatedFeature/@typeNameRealResource"/>
  93. </xsl:otherwise>
  94. </xsl:choose>
  95. </xsl:function>
  96. <xsl:function name="get_wfs_recurse_xsl:RelatedFilter">
  97. <xsl:param name="get_wfs_recurse_xsl:GetsimpleSchema"/>
  98. <xsl:value-of select="$get_wfs_recurse_xsl:GetsimpleSchema/(RelatedFeatureRoot|RelatedFeature)/RelatedFilter"/>
  99. </xsl:function>
  100. <xsl:template name="get_wfs_recurse_xsl:request_string">
  101. <xsl:param name="protocol" select="$protocol"/>
  102. <xsl:param name="api" select="$api"/>
  103. <xsl:param name="targetNamespace_DEFAULTS_prefix" select="$targetNamespace_DEFAULTS_prefix"/>
  104. <xsl:param name="username" select="$username"/>
  105. <xsl:param name="username.pass" select="$username.pass"/>
  106. <xsl:param name="REQUEST.SERVICE" select="'WFS'"/>
  107. <xsl:param name="REQUEST.VERSION" select="'1.0.0'"/>
  108. <xsl:param name="REQUEST.TYPE" select="'GetFeature'"/>
  109. <xsl:param name="REQUEST.MAXFEATURES" />
  110. <xsl:param name="REQUEST.TYPENAME" required="yes"/>
  111. <xsl:param name="OGC_Filter"/>
  112. <xsl:param name="REQUEST.SRSNAME" select="'EPSG:3003'"/>
  113. <xsl:variable name="php_session_id_ok.string">
  114. <xsl:if test=" string-length($php_session_id_ok.string) &gt; 0">
  115. <xsl:value-of select="concat('&amp;sid=',normalize-space($php_session_id_ok.string))"/>
  116. </xsl:if>
  117. </xsl:variable>
  118. <xsl:variable name="api_recurse.request">
  119. <xsl:choose>
  120. <xsl:when test="$api_recurse">
  121. <xsl:value-of select="concat('&amp;resolveDepth=',$resolveDepth,'&amp;resolve=all')"/>
  122. </xsl:when>
  123. </xsl:choose>
  124. </xsl:variable>
  125. <xsl:variable name="username_and_pass">
  126. <xsl:choose>
  127. <xsl:when test="string-length($php_session_id_ok.string) &gt; 0"/>
  128. <xsl:otherwise><xsl:value-of select="concat($username,':',$username.pass,'@')"/></xsl:otherwise>
  129. </xsl:choose>
  130. </xsl:variable>
  131. <xsl:variable name="REQUEST.MAXFEATURES">
  132. <xsl:choose>
  133. <xsl:when test=" string-length($REQUEST.MAXFEATURES) &gt; 0">
  134. <xsl:value-of select="concat('&amp;MAXFEATURES=',$REQUEST.MAXFEATURES)"/>
  135. </xsl:when>
  136. </xsl:choose>
  137. </xsl:variable>
  138. <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>
  139. <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)"/>
  140. </xsl:template>
  141. <xsl:template match="*" mode="get_wfs_recurse_xsl:context.nodes">
  142. <xsl:for-each select=".//*[@fid]">
  143. <get_wfs_recurse_xsl:nodes fid="{@fid}" root.distance="{count( ancestor::node())}"/>
  144. </xsl:for-each>
  145. </xsl:template>
  146. <xsl:function name="get_wfs_recurse_xsl:context.PRIMARYKEY.merge">
  147. <xsl:param name="get_wfs_recurse_xsl:PRIMARYKEY.nodes"/>
  148. <xsl:param name="p5:fid"/>
  149. <xsl:choose>
  150. <xsl:when test=" string-length($p5:fid) &gt;0">
  151. <get_wfs_recurse_xsl:context.nodes>
  152. <xsl:copy-of select="$get_wfs_recurse_xsl:PRIMARYKEY.nodes/get_wfs_recurse_xsl:PRIMARYKEY.nodes/*"/>
  153. <get_wfs_recurse_xsl:nodes fid="{$p5:fid}"/>
  154. </get_wfs_recurse_xsl:context.nodes>
  155. </xsl:when>
  156. <xsl:otherwise>
  157. <xsl:copy-of select="$get_wfs_recurse_xsl:PRIMARYKEY.nodes"/>
  158. </xsl:otherwise>
  159. </xsl:choose>
  160. </xsl:function>
  161. <xsl:function name="get_wfs_recurse_xsl:context.nodes.merge">
  162. <xsl:param name="get_wfs_recurse_xsl:context.nodes"/>
  163. <xsl:param name="current.node"/>
  164. <get_wfs_recurse_xsl:context.nodes>
  165. <xsl:copy-of select="$get_wfs_recurse_xsl:context.nodes/get_wfs_recurse_xsl:context.nodes/*"/>
  166. <xsl:for-each select="$current.node//*[@fid]">
  167. <get_wfs_recurse_xsl:nodes fid="{@fid}" root.distance="{count( ancestor::node())}" added="by_merge"/>
  168. </xsl:for-each>
  169. </get_wfs_recurse_xsl:context.nodes>
  170. </xsl:function>
  171. <xsl:function name="get_wfs_recurse_xsl:simpleTypeMakeOgcFilter">
  172. <xsl:param name="get_wfs_recurse_xsl:GetsimpleSchema"/>
  173. <xsl:copy-of select="$get_wfs_recurse_xsl:GetsimpleSchema/RelatedFeature/simpleTypeMakeOgcFilter"/>
  174. </xsl:function>
  175. <xsl:function name="get_wfs_recurse_xsl:xpath_dita">
  176. <xsl:param name="xpath"/>
  177. <xsl:param name="get_wfs_recurse_xsl:xpath"/>
  178. <xsl:choose>
  179. <xsl:when test=" string-length($get_wfs_recurse_xsl:xpath) &gt;0">
  180. <xsl:value-of select="$get_wfs_recurse_xsl:xpath"/>
  181. <xsl:if test="$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>
  182. </xsl:when>
  183. <xsl:otherwise><xsl:value-of select="$xpath"/></xsl:otherwise>
  184. </xsl:choose>
  185. </xsl:function>
  186. <xsl:function name="get_wfs_recurse_xsl:xpath_value_dita">
  187. <xsl:param name="xpath"/>
  188. <xsl:param name="xpath_value"/>
  189. <!--<xsl:param name="get_wfs_recurse_xsl:xpath_value"/>-->
  190. <xsl:param name="input_obj_with_xpath"/>
  191. <xsl:variable name="get_wfs_recurse_xsl:xpath_value_dita">
  192. <xsl:choose>
  193. <xsl:when test="$xpath_value">
  194. <!--<xsl:variable name="xpath_value_tokens" select="tokenize(@xpath_value,'/')"/>-->
  195. <!--<xsl:value-of select="'todo zapytanie xpath do przetworzenia'"/>-->
  196. <!--<xsl:copy-of select="$xpath_value_tokens"></xsl:copy-of>-->
  197. <!--<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>-->
  198. <!--<xsl:if test="$debug &gt; 2"><xsl:message>#67.1 $input_obj_with_xpath: <xsl:copy-of select="$input_obj_with_xpath"/> </xsl:message></xsl:if>-->
  199. <!--<xsl:variable name="xpath_value_token">-->
  200. <xsl:call-template name="xpath_filter_apply">
  201. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  202. <xsl:with-param name="xpath" select="$xpath"/>
  203. <xsl:with-param name="xpath_value" select="$xpath_value"/>
  204. </xsl:call-template>
  205. <!--</xsl:variable>-->
  206. <!--<xsl:message>#73 ustalam na <xsl:value-of select="$xpath_value_token/node()[1]/text()"/>;</xsl:message>-->
  207. <!--<xsl:value-of select="$xpath_value_token/node()[1]/text()"/>-->
  208. <!--<xsl:value-of select="$xpath_value_token"/>-->
  209. </xsl:when>
  210. <!--<xsl:when test="string-length($get_wfs_recurse_xsl:xpath_value) &gt;0">
  211. <xsl:if test="$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>
  212. <xsl:value-of select="$get_wfs_recurse_xsl:xpath_value"/>
  213. </xsl:when>
  214. <xsl:otherwise>
  215. <xsl:value-of select="$get_wfs_recurse_xsl:xpath_value"/><!-\- parametr z template narzuca wartosc -\->
  216. </xsl:otherwise>-->
  217. </xsl:choose>
  218. </xsl:variable>
  219. <xsl:copy-of select="$get_wfs_recurse_xsl:xpath_value_dita"/>
  220. </xsl:function>
  221. <xsl:template match="And" mode="simpleTypeMakeOgcFilter_merge_apply">
  222. <xsl:choose>
  223. <xsl:when test="child::node()">
  224. <xsl:value-of select="'&lt;ogc:And&gt;'"/>
  225. <xsl:apply-templates mode="simpleTypeMakeOgcFilter_merge_apply"/>
  226. <xsl:value-of select="'&lt;/ogc:And&gt;'"/>
  227. </xsl:when>
  228. </xsl:choose>
  229. </xsl:template>
  230. <xsl:template match="*" mode="simpleTypeMakeOgcFilter_merge_apply" xpath-default-namespace="http://www.opengis.net/ogc">
  231. <xsl:value-of select="concat('&lt;',name(),'&gt;')"/>
  232. <xsl:apply-templates mode="simpleTypeMakeOgcFilter_merge_apply"/>
  233. <xsl:value-of select="concat('&lt;/',name(),'&gt;')"/>
  234. </xsl:template>
  235. <xsl:template match="text()" mode="simpleTypeMakeOgcFilter_merge_apply">
  236. <xsl:value-of select="."/>
  237. </xsl:template>
  238. <xsl:function name="p5:get_get_from_url">
  239. <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 -->
  240. <xsl:param name="get"/><!-- which param from get - maybe REQUEST -->
  241. <xsl:choose>
  242. <xsl:when test="contains($p5:url,'?')">
  243. <xsl:variable name="result">
  244. <xsl:for-each select="tokenize( substring-after($p5:url,'?'),'&amp;')">
  245. <xsl:if test="substring-before(.,'=') = $get"><xsl:value-of select="substring-after(.,'=')"/></xsl:if>
  246. </xsl:for-each>
  247. </xsl:variable>
  248. <xsl:choose>
  249. <xsl:when test="string-length($result) &gt; 0">
  250. <xsl:value-of select="$result"/>
  251. </xsl:when>
  252. <xsl:otherwise>
  253. <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>
  254. </xsl:otherwise>
  255. </xsl:choose>
  256. </xsl:when>
  257. <xsl:otherwise>
  258. <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>
  259. </xsl:otherwise>
  260. </xsl:choose>
  261. </xsl:function>
  262. <xsl:template match="@next" mode="p5:fid">
  263. <!-- 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 -->
  264. <xsl:variable name="TYPENAME" select="p5:get_get_from_url(.,'TYPENAME')"/>
  265. <xsl:variable name="PRIMARYKEY" select="p5:get_get_from_url(.,'PRIMARYKEY')"/>
  266. <xsl:variable name="TYPENAME">
  267. <xsl:choose>
  268. <xsl:when test="substring-after($TYPENAME,':')">
  269. <xsl:value-of select="substring-after($TYPENAME,':')"/>
  270. </xsl:when>
  271. <xsl:otherwise>
  272. <xsl:value-of select="$TYPENAME"/>
  273. </xsl:otherwise>
  274. </xsl:choose>
  275. </xsl:variable>
  276. <xsl:value-of select="concat($TYPENAME,'.',$PRIMARYKEY)"/>
  277. </xsl:template>
  278. <xsl:function name="p5:fid">
  279. <xsl:param name="p5:next"/>
  280. <xsl:choose>
  281. <xsl:when test="contains($p5:next,'PRIMARYKEY=')">
  282. <xsl:variable name="TYPENAME" select="p5:get_get_from_url($p5:next,'TYPENAME')"/>
  283. <xsl:variable name="PRIMARYKEY" select="p5:get_get_from_url($p5:next,'PRIMARYKEY')"/>
  284. <xsl:value-of select="concat($TYPENAME,'.',$PRIMARYKEY)"/>
  285. </xsl:when>
  286. <xsl:otherwise>
  287. <xsl:message>#312 cannot retrieve PRIMARYKEY from propably backreffed url=<xsl:value-of select="$p5:next"/></xsl:message>
  288. </xsl:otherwise>
  289. </xsl:choose>
  290. <!-- 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 -->
  291. </xsl:function>
  292. <xsl:template name="simpleTypeMakeOgcFilter_merge"><!-- do zrobienia polaczonego filtru OGC -->
  293. <xsl:param name="simpleTypeMakeOgcFilter" required="yes"/>
  294. <xsl:param name="xpath_dita" required="yes"/> <!-- @value -->
  295. <xsl:param name="xpath_value_dita" required="yes"/> <!-- @xpath_value -->
  296. <!-- <xsl:param name="get_wfs_recurse_xsl:xpath_dita" required="yes"/>
  297. <xsl:param name="get_wfs_recurse_xsl:xpath_value_dita" required="yes"/>-->
  298. <xsl:param name="RelatedFilter"/>
  299. <xsl:if test="$debug &gt; 2"><xsl:message>#1754 name="simpleTypeMakeOgcFilter_merge"
  300. $simpleTypeMakeOgcFilter = <xsl:copy-of select="$simpleTypeMakeOgcFilter"></xsl:copy-of>
  301. $get_wfs_recurse_xsl:xpath_dita = <xsl:copy-of select="$xpath_dita"/>
  302. $get_wfs_recurse_xsl:xpath_value_dita = <xsl:copy-of select="$xpath_value_dita"/>
  303. #EOF
  304. </xsl:message>
  305. </xsl:if>
  306. <xsl:value-of select="'&amp;Filter=&lt;ogc:Filter&gt;'"/>
  307. <xsl:variable name="Filter">
  308. <And>
  309. <xsl:for-each select="$RelatedFilter">
  310. <ogc:PropertyIsEqualTo>
  311. <ogc:PropertyName><xsl:value-of select="$xpath_dita"/></ogc:PropertyName>
  312. <ogc:Literal><xsl:value-of select="$xpath_value_dita"/></ogc:Literal>
  313. </ogc:PropertyIsEqualTo>
  314. </xsl:for-each>
  315. <ogc:PropertyIsEqualTo>
  316. <ogc:PropertyName><xsl:value-of select="$xpath_dita"/></ogc:PropertyName>
  317. <ogc:Literal><xsl:value-of select="$xpath_value_dita"/></ogc:Literal>
  318. </ogc:PropertyIsEqualTo>
  319. <And>
  320. <xsl:for-each select="$simpleTypeMakeOgcFilter/*">
  321. <xsl:copy-of select="."/>
  322. </xsl:for-each>
  323. </And>
  324. </And>
  325. </xsl:variable>
  326. <xsl:apply-templates select="$Filter" mode="simpleTypeMakeOgcFilter_merge_apply"/>
  327. <xsl:value-of select="'&lt;/ogc:Filter&gt;'"/>
  328. </xsl:template>
  329. <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 -->
  330. <xsl:param name="input_obj_with_xpath" required="yes"/>
  331. <xsl:param name="xpath" required="yes"/>
  332. <xsl:param name="xpath_value" required="yes"/>
  333. <xsl:variable name="xpath_value_token">
  334. <xsl:for-each select=" tokenize($xpath_value,'/')">
  335. <xsl:if test="$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>
  336. <xsl:if test="$input_obj_with_xpath/node()[@xpath=current()]">
  337. <xsl:copy-of select="$input_obj_with_xpath/node()[@xpath=current()]"/>
  338. </xsl:if><!-- todo to jest bledne ale dziala tymczasowo-->
  339. </xsl:for-each>
  340. </xsl:variable>
  341. <xsl:if test="$debug &gt; 2"><xsl:message>#345 ustalam na <xsl:value-of select="$xpath_value_token/node()[1]/text()"/>;</xsl:message></xsl:if>
  342. <!--<xsl:value-of select="$xpath_value_token/node()[1]/text()"/>-->
  343. <xsl:value-of select="$xpath_value_token"/>
  344. </xsl:template>
  345. <!--${simpleSchema_dir}/${namespace_prefix_p5_tr_map}/${main_build_recurse_ant.tr_map_sed}.xml-->
  346. <xsl:template name="main">
  347. <xsl:param name="typeName" select="$typeName"/>
  348. <xsl:param name="api" select="$api"/>
  349. <xsl:param name="protocol" select="$protocol"/>
  350. <xsl:param name="targetNamespace_DEFAULTS_prefix" select="$targetNamespace_DEFAULTS_prefix"/>
  351. <!--<xsl:param name="xpath_value" select="$xpath_value"/>-->
  352. <xsl:param name="get_wfs_recurse_xsl:xpath"/>
  353. <xsl:message>#255 typeName = <xsl:value-of select="$typeName"/></xsl:message>
  354. <RelatedFeatureRoot>
  355. <!--<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'"/>-->
  356. <xsl:variable name="input_obj_with_xpath"><input_obj_with_xpath/></xsl:variable>
  357. <xsl:variable name="get_wfs_recurse_xsl:GetsimpleSchema" select="get_wfs_recurse_xsl:GetsimpleSchema($typeName)"/>
  358. <!--<xsl:copy-of select="$get_wfs_recurse_xsl:GetsimpleSchema"/>-->
  359. <xsl:variable name="get_wfs_recurse_xsl:typeNameRealResource" select="get_wfs_recurse_xsl:typeNameRealResource($get_wfs_recurse_xsl:GetsimpleSchema)"/>
  360. <xsl:variable name="xpath_dita" select="$xpath"/>
  361. <xsl:variable name="xpath_value_dita" select="$xpath_value"/>
  362. <xsl:variable name="get_wfs_recurse_xsl:simpleTypeMakeOgcFilter" select="get_wfs_recurse_xsl:simpleTypeMakeOgcFilter($get_wfs_recurse_xsl:GetsimpleSchema)"/>
  363. <xsl:variable name="get_wfs_recurse_xsl:RelatedFilter" select="get_wfs_recurse_xsl:RelatedFilter($get_wfs_recurse_xsl:GetsimpleSchema)"/>
  364. <xsl:variable name="OGC_Filter">
  365. <xsl:call-template name="simpleTypeMakeOgcFilter_merge">
  366. <xsl:with-param name="simpleTypeMakeOgcFilter" select="$get_wfs_recurse_xsl:simpleTypeMakeOgcFilter"/>
  367. <xsl:with-param name="RelatedFilter" select="$get_wfs_recurse_xsl:RelatedFilter"/>
  368. <xsl:with-param name="xpath_dita" select="$xpath"/>
  369. <xsl:with-param name="xpath_value_dita" select="$xpath_value"/>
  370. <!--<xsl:with-param name="get_wfs_recurse_xsl:xpath_dita" select="$xpath"/>-->
  371. <!--<xsl:with-param name="get_wfs_recurse_xsl:xpath_value_dita" select="$xpath_value"/>-->
  372. </xsl:call-template>
  373. </xsl:variable>
  374. <xsl:if test="$debug &gt; 3">
  375. <xpath_dita>
  376. <xsl:value-of select="$xpath_dita"></xsl:value-of>
  377. </xpath_dita>
  378. <xpath_value_dita>
  379. <xsl:value-of select="$xpath_value_dita"></xsl:value-of>
  380. </xpath_value_dita>
  381. <!-- <get_wfs_recurse_xsl:simpleTypeMakeOgcFilter>
  382. <xsl:copy-of select="$get_wfs_recurse_xsl:simpleTypeMakeOgcFilter"/>
  383. </get_wfs_recurse_xsl:simpleTypeMakeOgcFilter>
  384. <Filter>
  385. <xsl:copy-of select="$OGC_Filter"/>
  386. </Filter>-->
  387. </xsl:if>
  388. <!--<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 -->
  389. <xsl:variable name="request_string">
  390. <xsl:call-template name="get_wfs_recurse_xsl:request_string">
  391. <xsl:with-param name="OGC_Filter" select="$OGC_Filter"/>
  392. <xsl:with-param name="REQUEST.TYPE" select="'GetFeature'"/>
  393. <xsl:with-param name="REQUEST.TYPENAME" select="$get_wfs_recurse_xsl:typeNameRealResource"/>
  394. </xsl:call-template>
  395. </xsl:variable>
  396. <!--<xsl:variable name="url_string" select="concat($protocol,$username,':',$username.pass,'@',$api,'/',$targetNamespace_DEFAULTS_prefix,'/',$request_string)"/>-->
  397. <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"/>
  398. p5:links.recurse_level.limit = <xsl:value-of select="$p5:links.recurse_level.limit"/>
  399. p5:links.next.recurse_level.limit = <xsl:value-of select="$p5:links.next.recurse_level.limit"/>
  400. resolveDepth = <xsl:value-of select="$resolveDepth"/>
  401. </xsl:message>
  402. <xsl:variable name="get_wfs_recurse_xsl:wfs_response" select="doc($request_string)"/>
  403. <xsl:if test="$debug &gt; 5">
  404. <wfs_response>
  405. <request>Retrieving <xsl:value-of select="$request_string"/></request>
  406. <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>
  407. <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>
  408. <!--<xsl:copy-of select="$wfs_response"/>-->
  409. <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response"/>
  410. </wfs_response>
  411. </xsl:if>
  412. <xsl:variable name="get_wfs_recurse_xsl:context.nodes">
  413. <get_wfs_recurse_xsl:context.nodes>
  414. <xsl:apply-templates mode="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:wfs_response"/>
  415. </get_wfs_recurse_xsl:context.nodes>
  416. </xsl:variable>
  417. <xsl:variable name="get_wfs_recurse_xsl:context.PRIMARYKEY">
  418. <get_wfs_recurse_xsl:context.PRIMARYKEY>
  419. <xsl:for-each select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember/*">
  420. <get_wfs_recurse_xsl:nodes>
  421. <xsl:attribute name="fid" select="@fid"/>
  422. </get_wfs_recurse_xsl:nodes>
  423. </xsl:for-each>
  424. </get_wfs_recurse_xsl:context.PRIMARYKEY>
  425. </xsl:variable>
  426. <xsl:if test="number($debug) &gt; 3">
  427. <xsl:copy-of select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
  428. <xsl:copy-of select="$get_wfs_recurse_xsl:context.nodes"/>
  429. </xsl:if>
  430. <xsl:choose>
  431. <xsl:when test="$api_recurse">
  432. <xsl:if test="$get_wfs_recurse_xsl:wfs_response/ServiceExceptionReport" xpath-default-namespace="http://www.opengis.net/ogc">
  433. <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>
  434. </xsl:if>
  435. <xsl:choose>
  436. <xsl:when test="$get_wfs_recurse_xsl:wfs_response//p5:next">
  437. <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>
  438. <!--<xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/namespace::node()"/> <!-\- [ not(contains( local-name(),'wfs'))] -\->
  439. <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember/namespace::node()"/>
  440. <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember/*/namespace::node()"/>
  441. <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember//*/namespace::node()"/>-->
  442. <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">
  443. <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:context.nodes"/>
  444. <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
  445. <xsl:with-param name="debug.last_wfs_request" select="$request_string"/>
  446. </xsl:apply-templates>
  447. </xsl:when>
  448. <xsl:otherwise>
  449. <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/gml:featureMember/*"/>
  450. <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">
  451. <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:context.nodes"/>
  452. <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
  453. <xsl:with-param name="debug.last_wfs_request" select="$request_string"/>
  454. </xsl:apply-templates>
  455. </xsl:otherwise>
  456. </xsl:choose>
  457. </xsl:when>
  458. <xsl:otherwise>
  459. <xsl:apply-templates mode="after_first_ant_assing_vars" select="$get_wfs_recurse_xsl:GetsimpleSchema">
  460. <xsl:with-param name="get_wfs_recurse_xsl:wfs_response" select="$get_wfs_recurse_xsl:wfs_response"/>
  461. <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:context.nodes"/>
  462. <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
  463. <xsl:with-param name="debug.last_wfs_request" select="$request_string"/>
  464. </xsl:apply-templates>
  465. </xsl:otherwise>
  466. </xsl:choose>
  467. </RelatedFeatureRoot>
  468. </xsl:template>
  469. <xsl:template match="*[@xlink:href]" mode="p5:links.evaluate" xpath-default-namespace="http://www.opengis.net/wfs">
  470. <xsl:param name="p5:links.recurse_level" select="1"/>
  471. <xsl:param name="p5:links.next.recurse_level" select="1"/>
  472. <xsl:param name="get_wfs_recurse_xsl:context.nodes" required="yes"/>
  473. <xsl:param name="get_wfs_recurse_xsl:context.PRIMARYKEY" required="yes"/>
  474. <xsl:param name="debug.last_wfs_request" required="yes"/>
  475. <xsl:variable name="p5:fid" select="get_wfs_recurse_xsl:REQUEST.fid(@xlink:href)"/>
  476. <!--<xlink:href.evaluate>-->
  477. <!-- <xsl:copy>
  478. <xsl:copy-of select="@*"/>-->
  479. <xsl:if test="number($debug) &gt; 3">
  480. <xlink:href.debug509>
  481. <xsl:attribute name="debug.last_wfs_request" select="$debug.last_wfs_request"/>
  482. <xsl:copy-of select="@*"/>
  483. <xsl:copy-of select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
  484. <xsl:copy-of select="$get_wfs_recurse_xsl:context.nodes"/>
  485. </xlink:href.debug509>
  486. </xsl:if>
  487. <xsl:message>#516-A name()<xsl:value-of select="name()"/>; ORIGINAL_@xlink:href=<xsl:value-of select="@xlink:href"/>;</xsl:message>
  488. <xsl:comment>#516-A name()<xsl:value-of select="name()"/>; ORIGINAL_@xlink:href=<xsl:value-of select="@xlink:href"/>;</xsl:comment>
  489. <xsl:variable name="xlink:request_string">
  490. <xsl:apply-templates mode="xlink:request_string" select=".">
  491. <xsl:with-param name="p5:links.recurse_level" select="$p5:links.recurse_level"/>
  492. </xsl:apply-templates>
  493. </xsl:variable>
  494. <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>
  495. <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>
  496. <!--<xsl:message>#401 previous @fid
  497. <xsl:for-each select="root()//*[@fid]">
  498. <xsl:value-of select="@fid"/>
  499. </xsl:for-each>
  500. </xsl:message>-->
  501. <xsl:choose>
  502. <xsl:when test="$get_wfs_recurse_xsl:context.nodes//*[@fid = get_wfs_recurse_xsl:REQUEST.fid( current()/@xlink:href)]">
  503. <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>
  504. <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>
  505. </xsl:when>
  506. <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)]">
  507. <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>
  508. <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>
  509. </xsl:when>
  510. <xsl:when test="p5:links.recurse_level.limit($p5:links.recurse_level)">
  511. <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>
  512. <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>
  513. <xsl:copy-of select="."/>
  514. </xsl:when>
  515. <xsl:when test=" string-length($xlink:request_string) = 0">
  516. <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>
  517. <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>
  518. </xsl:when>
  519. <xsl:otherwise>
  520. <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>
  521. <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>
  522. <!--<xsl:variable name="xlink:request_string">
  523. <xsl:apply-templates mode="xlink:request_string" select="."/>
  524. </xsl:variable>-->
  525. <xsl:apply-templates select=" get_wfs_recurse_xsl:wfs_response($xlink:request_string)" mode="p5:links.evaluate">
  526. <xsl:with-param name="p5:links.recurse_level" select="number($p5:links.recurse_level) + 1"/>
  527. <xsl:with-param name="p5:links.next.recurse_level" select="1"/> <!-- $p5:links.next.recurse_level TODO researching start from beginning -->
  528. <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:context.nodes"/>
  529. <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)"/>
  530. <xsl:with-param name="debug.last_wfs_request" select="$xlink:request_string"/>
  531. </xsl:apply-templates>
  532. </xsl:otherwise>
  533. </xsl:choose>
  534. <!--</xsl:copy>-->
  535. <!--</xlink:href.evaluate>-->
  536. </xsl:template>
  537. <xsl:template match="*" mode="p5:links.evaluate" xpath-default-namespace="http://www.opengis.net/wfs">
  538. <xsl:param name="p5:links.recurse_level" select="1"/>
  539. <xsl:param name="p5:links.next.recurse_level" select="1"/>
  540. <xsl:param name="get_wfs_recurse_xsl:context.nodes" required="yes"/>
  541. <xsl:param name="get_wfs_recurse_xsl:context.PRIMARYKEY" required="yes"/>
  542. <xsl:param name="debug.last_wfs_request" required="yes"/>
  543. <!-- <xsl:element name="{name()}" inherit-namespaces="yes">
  544. <xsl:copy-of select="namespace::node()"/>-->
  545. <xsl:choose>
  546. <xsl:when test="count($get_wfs_recurse_xsl:context.nodes//*[@fid = current()/@fid ]) &gt; 1">
  547. <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>
  548. <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>
  549. <xsl:if test="number($debug) &gt; 3">
  550. <xsl:copy-of select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
  551. <xsl:copy-of select="$get_wfs_recurse_xsl:context.nodes"/>
  552. </xsl:if>
  553. </xsl:when>
  554. <xsl:otherwise>
  555. <xsl:copy><!-- debug -->
  556. <xsl:copy-of select="@*"/>
  557. <!--<xsl:attribute name="debug.566"> match=* mode=p5:links.evaluate</xsl:attribute>-->
  558. <xsl:apply-templates mode="xlink:href.evaluate" select="@xlink:href">
  559. <xsl:with-param name="p5:links.recurse_level" select="$p5:links.recurse_level"/>
  560. <xsl:with-param name="p5:links.next.recurse_level" select="$p5:links.next.recurse_level"/>
  561. <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:context.nodes"/>
  562. <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
  563. <xsl:with-param name="debug.last_wfs_request" select="$debug.last_wfs_request"/>
  564. </xsl:apply-templates>
  565. <xsl:apply-templates mode="p5:links.evaluate">
  566. <xsl:with-param name="p5:links.recurse_level" select="$p5:links.recurse_level"/>
  567. <xsl:with-param name="p5:links.next.recurse_level" select="$p5:links.next.recurse_level"/>
  568. <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:context.nodes"/>
  569. <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
  570. <xsl:with-param name="debug.last_wfs_request" select="$debug.last_wfs_request"/>
  571. </xsl:apply-templates>
  572. <!--</xsl:element>-->
  573. </xsl:copy>
  574. </xsl:otherwise>
  575. </xsl:choose>
  576. <!--<xsl:element name="{name()}" inherit-namespaces="yes" xpath-default-namespace="http://www.opengis.net/wfs">
  577. <xsl:apply-templates mode="p5:links.evaluate"/>
  578. </xsl:element>-->
  579. </xsl:template>
  580. <xsl:function name="p5:links.recurse_level.limit">
  581. <xsl:param name="p5:links.recurse_level"/>
  582. <xsl:choose>
  583. <xsl:when test="number($p5:links.recurse_level) &gt;= number($p5:links.recurse_level.limit)">
  584. <xsl:value-of select="'limit hit'"/>
  585. <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>
  586. <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>
  587. </xsl:when>
  588. </xsl:choose>
  589. </xsl:function>
  590. <xsl:function name="p5:links.next.recurse_level.limit">
  591. <xsl:param name="p5:links.next.recurse_level"/>
  592. <xsl:choose>
  593. <xsl:when test="number($p5:links.next.recurse_level.limit) &gt; number($p5:links.next.recurse_level.limit)">
  594. <xsl:value-of select="'limit hit'"/>
  595. <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>
  596. <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>
  597. </xsl:when>
  598. </xsl:choose>
  599. </xsl:function>
  600. <xsl:function name="get_wfs_recurse_xsl:php_session_id_ok.string">
  601. <xsl:param name="php_session_id_ok.string"/>
  602. <xsl:if test=" string-length($php_session_id_ok.string) &gt; 0">
  603. <xsl:value-of select="concat('&amp;sid=',normalize-space($php_session_id_ok.string))"/>
  604. </xsl:if>
  605. </xsl:function>
  606. <xsl:function name="get_wfs_recurse_xsl:api_recurse.request">
  607. <xsl:param name="api_recurse"/>
  608. <xsl:param name="p5:links.recurse_level"/>
  609. <xsl:choose>
  610. <xsl:when test="$api_recurse and ( ( number($p5:links.recurse_level) + number($resolveDepth) ) &gt; $p5:links.recurse_level.limit )">
  611. <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>
  612. <xsl:value-of select="concat('&amp;resolveDepth=',($p5:links.recurse_level.limit - $p5:links.recurse_level ),'&amp;resolve=all')"/>
  613. </xsl:when>
  614. <xsl:when test="$api_recurse and number($p5:links.recurse_level)">
  615. <xsl:value-of select="concat('&amp;resolveDepth=',$resolveDepth,'&amp;resolve=all')"/>
  616. </xsl:when>
  617. </xsl:choose>
  618. </xsl:function>
  619. <xsl:function name="get_wfs_recurse_xsl:api_recurse.request">
  620. <xsl:param name="api_recurse"/>
  621. <xsl:choose>
  622. <xsl:when test="$api_recurse">
  623. <xsl:value-of select="concat('&amp;resolveDepth=',$resolveDepth,'&amp;resolve=all')"/>
  624. </xsl:when>
  625. </xsl:choose>
  626. </xsl:function>
  627. <xsl:function name="get_wfs_recurse_xsl:username_and_pass">
  628. <xsl:param name="php_session_id_ok.string"/>
  629. <xsl:choose>
  630. <xsl:when test="string-length($php_session_id_ok.string) &gt; 0"/>
  631. <xsl:otherwise><xsl:value-of select="concat($username,':',$username.pass,'@')"/></xsl:otherwise>
  632. </xsl:choose>
  633. </xsl:function>
  634. <xsl:function name="get_wfs_recurse_xsl:api">
  635. <xsl:param name="xlink:href"/>
  636. <xsl:variable name="string_tokens" select="count(tokenize($xlink:href,'/'))"/>
  637. <xsl:variable name="get_wfs_recurse_xsl:api">
  638. <xsl:for-each select="tokenize($xlink:href,'/')[ position() &lt; $string_tokens]">
  639. <xsl:value-of select="."/><xsl:text>/</xsl:text>
  640. </xsl:for-each>
  641. </xsl:variable>
  642. <xsl:choose>
  643. <xsl:when test=" contains( substring-after($get_wfs_recurse_xsl:api/text(),'://'), substring-before($api,'/'))">
  644. <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>
  645. <xsl:value-of select="$api"/>
  646. </xsl:when>
  647. <xsl:otherwise>
  648. <xsl:value-of select=" substring-after($get_wfs_recurse_xsl:api/text(),'://')"/>
  649. </xsl:otherwise>
  650. </xsl:choose>
  651. <!--<xsl:value-of select="tokenize($xlink:href,'/')[ 1 to count(tokenize($xlink:href,'.'))]"/>-->
  652. </xsl:function>
  653. <xsl:function name="get_wfs_recurse_xsl:REQUEST.fid">
  654. <xsl:param name="xlink:href"/>
  655. <xsl:choose>
  656. <xsl:when test="substring-after($xlink:href,'#')">
  657. <xsl:value-of select=" substring-after($xlink:href,'#')"/>
  658. </xsl:when>
  659. <xsl:otherwise><xsl:value-of select="false()"/></xsl:otherwise>
  660. </xsl:choose>
  661. </xsl:function>
  662. <xsl:function name="get_wfs_recurse_xsl:REQUEST.TYPE.PRIMARYKEY">
  663. <xsl:param name="xlink:href"/>
  664. <xsl:choose>
  665. <xsl:when test=" string-length(tokenize($xlink:href,'\.')[ count(tokenize($xlink:href,'\.'))]) &gt; 0">
  666. <xsl:value-of select="concat('&amp;PRIMARYKEY=',tokenize($xlink:href,'\.')[ count(tokenize($xlink:href,'\.')) ])"/>
  667. </xsl:when>
  668. <xsl:otherwise>
  669. <xsl:message terminate="no">#495 ERROR with detecting get_wfs_recurse_xsl:REQUEST.TYPE.PRIMARYKEY from <xsl:value-of select="$xlink:href"/>
  670. tokens count=<xsl:value-of select="count(tokenize($xlink:href,'\.'))"/>
  671. </xsl:message>
  672. </xsl:otherwise>
  673. </xsl:choose>
  674. </xsl:function>
  675. <xsl:function name="get_wfs_recurse_xsl:protocol">
  676. <xsl:param name="xlink:href"/>
  677. <xsl:value-of select=" concat(substring-before($xlink:href,'://'),'://')"/>
  678. </xsl:function>
  679. <xsl:template match="*[@xlink:href]" mode="xlink:request_string">
  680. <xsl:param name="protocol" select="get_wfs_recurse_xsl:protocol(@xlink:href)"/>
  681. <xsl:param name="api" select="get_wfs_recurse_xsl:api(@xlink:href)"/>
  682. <xsl:param name="targetNamespace_DEFAULTS_prefix" select="$targetNamespace_DEFAULTS_prefix"/>
  683. <xsl:param name="username" select="$username"/>
  684. <xsl:param name="username.pass" select="$username.pass"/>
  685. <xsl:param name="REQUEST.SERVICE" select="'WFS'"/>
  686. <xsl:param name="REQUEST.VERSION" select="'1.0.0'"/>
  687. <xsl:param name="REQUEST.TYPE" select="'GetFeature'"/>
  688. <!--<xsl:param name="REQUEST.MAXFEATURES" />-->
  689. <xsl:param name="REQUEST.TYPENAME" select="name()"/>
  690. <xsl:param name="OGC_Filter"/>
  691. <xsl:param name="REQUEST.SRSNAME" select="'EPSG:3003'"/>
  692. <xsl:param name="p5:links.recurse_level"/>
  693. <xsl:param name="api.local_location" select="'SE/version-git/wfs-data.php/default_db/'"/>
  694. <xsl:variable name="php_session_id_ok.string" select="get_wfs_recurse_xsl:php_session_id_ok.string($php_session_id_ok.string)"/>
  695. <xsl:variable name="api_recurse.request" select="get_wfs_recurse_xsl:api_recurse.request($api_recurse)"/>
  696. <xsl:variable name="username_and_pass" select="get_wfs_recurse_xsl:username_and_pass($php_session_id_ok.string)"/>
  697. <xsl:variable name="REQUEST.TYPE.PRIMARYKEY" select="get_wfs_recurse_xsl:REQUEST.TYPE.PRIMARYKEY(@xlink:href)"/>
  698. <xsl:variable name="REQUEST.MAXFEATURES">
  699. <xsl:choose>
  700. <xsl:when test="contains(@xlink:href,'&amp;maxFeatures=10')">
  701. <xsl:value-of select="concat('&amp;maxFeatures=',$MAXFEATURES)"/>
  702. </xsl:when>
  703. <xsl:when test="contains(@xlink:href,'&amp;maxFeatures=20')">
  704. <xsl:value-of select="concat('&amp;maxFeatures=',$MAXFEATURES)"/>
  705. </xsl:when>
  706. <xsl:when test="contains(@xlink:href,'maxFeatures')"/>
  707. <xsl:otherwise><xsl:value-of select="concat('&amp;maxFeatures=',$MAXFEATURES)"/></xsl:otherwise>
  708. </xsl:choose>
  709. </xsl:variable>
  710. <xsl:if test="number($debug) &gt; 3"><xsl:message>#497 detected $api = <xsl:value-of select="$api"/>; </xsl:message>
  711. <xsl:message>#497 REQUEST.TYPE.PRIMARYKEY=<xsl:value-of select="$REQUEST.TYPE.PRIMARYKEY"/>;</xsl:message>
  712. </xsl:if>
  713. <xsl:choose>
  714. <xsl:when test=" string-length($REQUEST.TYPE.PRIMARYKEY) &gt; 0">
  715. <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)"/>
  716. </xsl:when>
  717. <xsl:otherwise>
  718. <xsl:message>#532 ERROR with requests - debug it and stop recurse</xsl:message>
  719. </xsl:otherwise>
  720. </xsl:choose>
  721. </xsl:template>
  722. <xsl:function name="get_wfs_recurse_xsl:wfs_response">
  723. <xsl:param name="request_string"/>
  724. <xsl:message>#741 quering wfs for request_string= <xsl:value-of select="$request_string"/> ;</xsl:message>
  725. <xsl:variable name="get_wfs_recurse_xsl:wfs_response" select="doc($request_string)"/>
  726. <xsl:if test="$get_wfs_recurse_xsl:wfs_response/ServiceExceptionReport" xpath-default-namespace="http://www.opengis.net/ogc">
  727. <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>
  728. </xsl:if>
  729. <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response"/>
  730. </xsl:function>
  731. <xsl:template match="@*" mode="p5:links.evaluate">
  732. <xsl:copy-of select="."/>
  733. </xsl:template>
  734. <xsl:template match="text()" mode="p5:links.evaluate">
  735. <xsl:copy-of select="."/>
  736. </xsl:template>
  737. <xsl:template match="p5:links" mode="p5:links.evaluate">
  738. <xsl:param name="p5:links.recurse_level" select="1"/>
  739. <xsl:param name="p5:links.next.recurse_level" select="1"/>
  740. <xsl:param name="get_wfs_recurse_xsl:context.nodes" required="yes"/>
  741. <xsl:param name="get_wfs_recurse_xsl:context.PRIMARYKEY" required="yes"/>
  742. <xsl:param name="debug.last_wfs_request" required="yes"/>
  743. <xsl:variable name="php_session_id_ok.string">
  744. <xsl:if test=" string-length($php_session_id_ok.string) &gt; 0">
  745. <xsl:value-of select="concat('&amp;sid=',normalize-space($php_session_id_ok.string))"/>
  746. </xsl:if>
  747. </xsl:variable>
  748. <!--<xsl:variable name="api_recurse.request">
  749. <xsl:choose>
  750. <xsl:when test="$api_recurse">
  751. <xsl:value-of select="concat('&amp;resolveDepth=',$resolveDepth,'&amp;resolve=all')"/>
  752. </xsl:when>
  753. </xsl:choose>
  754. </xsl:variable>-->
  755. <!-- <xsl:copy>-->
  756. <p5:links><xsl:copy-of select="*"/></p5:links>
  757. <xsl:variable name="p5:fid" select="p5:fid(p5:next/text())"/>
  758. <xsl:message>#684 debug match="p5:links" detected $p5:fid = <xsl:value-of select="$p5:fid"/></xsl:message>
  759. <xsl:comment>#684 debug match="p5:links" detected $p5:fid = <xsl:value-of select="$p5:fid"/></xsl:comment>
  760. <xsl:if test="number($debug) &gt; 3">
  761. <xsl:copy-of select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
  762. <xsl:copy-of select="$get_wfs_recurse_xsl:context.nodes"/>
  763. </xsl:if>
  764. <xsl:choose>
  765. <xsl:when test="$get_wfs_recurse_xsl:context.nodes//*[@fid = $p5:fid ]">
  766. <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>
  767. <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>
  768. </xsl:when>
  769. <xsl:when test="number($p5:links.recurse_level) &gt;= number($p5:links.recurse_level.limit)">
  770. <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>
  771. <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>
  772. </xsl:when>
  773. <xsl:when test="$get_wfs_recurse_xsl:context.PRIMARYKEY//*[@fid = $p5:fid]">
  774. <xsl:message> #690 STOPPED match="p5:links" DETECTED PRIMARYKEY FUTURE LOOP BY PRIMARY KEY $p5:fid=<xsl:value-of select="$p5:fid"/>;</xsl:message>
  775. <xsl:comment> #690 STOPPED match="p5:links" DETECTED PRIMARYKEY FUTURE LOOP BY PRIMARY KEY $p5:fid=<xsl:value-of select="$p5:fid"/>;</xsl:comment>
  776. </xsl:when>
  777. <xsl:when test="$get_wfs_recurse_xsl:context.PRIMARYKEY//*[@fid = $p5:fid]">
  778. <xsl:message> #691 STOPPED match="p5:links" DETECTED FUTURE LOOP BY PRIMARY KEY $p5:fid=<xsl:value-of select="$p5:fid"/>;</xsl:message>
  779. <xsl:comment> #691 STOPPED match="p5:links" DETECTED FUTURE LOOP BY PRIMARY KEY $p5:fid=<xsl:value-of select="$p5:fid"/>;</xsl:comment>
  780. </xsl:when>
  781. <xsl:otherwise>
  782. <xsl:variable name="MAXFEATURES.request">
  783. <xsl:choose>
  784. <xsl:when test="contains(p5:next/text(),'maxFeatures=10')">
  785. <xsl:value-of select="concat('&amp;maxFeatures=',$MAXFEATURES)"/>
  786. </xsl:when>
  787. <xsl:when test="contains(p5:next/text(),'maxFeatures=20')">
  788. <xsl:value-of select="concat('&amp;maxFeatures=',$MAXFEATURES)"/>
  789. </xsl:when>
  790. <xsl:when test="contains(p5:next/text(),'maxFeatures')"/>
  791. <xsl:otherwise><xsl:value-of select="concat('&amp;maxFeatures=',$MAXFEATURES)"/></xsl:otherwise>
  792. </xsl:choose>
  793. </xsl:variable>
  794. <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' -->
  795. <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>
  796. <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>
  797. <!--<request_string>
  798. <xsl:copy-of select="$request_string"/>
  799. </request_string>-->
  800. <xsl:variable name="get_wfs_recurse_xsl:wfs_response" select="doc($request_string)"/>
  801. <xsl:if test="$get_wfs_recurse_xsl:wfs_response/ServiceExceptionReport" xpath-default-namespace="http://www.opengis.net/ogc">
  802. <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>
  803. </xsl:if>
  804. <xsl:choose>
  805. <xsl:when test="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/@next">
  806. <!--<debug.438>-->
  807. <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>
  808. <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>
  809. <xsl:apply-templates mode="#current" select="$get_wfs_recurse_xsl:wfs_response">
  810. <xsl:with-param name="p5:links.recurse_level" select="number($p5:links.recurse_level)"/> <!-- + 1 --><!-- setting to 1 again to research child node -->
  811. <xsl:with-param name="p5:links.next.recurse_level" select="number($p5:links.next.recurse_level) + 1"/>
  812. <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)"/>
  813. <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)"/>
  814. <xsl:with-param name="debug.last_wfs_request" select="$request_string"/>
  815. </xsl:apply-templates>
  816. <!--</debug.438>-->
  817. </xsl:when>
  818. <xsl:when test="$get_wfs_recurse_xsl:wfs_response//p5:next">
  819. <!--<debug.441>-->
  820. <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>
  821. <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>
  822. <xsl:apply-templates mode="#current" select="$get_wfs_recurse_xsl:wfs_response">
  823. <xsl:with-param name="p5:links.recurse_level" select="$p5:links.recurse_level"/> <!-- + 1 ) -->
  824. <xsl:with-param name="p5:links.next.recurse_level" select=" number($p5:links.next.recurse_level) + 1"/>
  825. <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)"/>
  826. <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)"/>
  827. <xsl:with-param name="debug.last_wfs_request" select="$request_string"/>
  828. </xsl:apply-templates>
  829. <!--</debug.441>-->
  830. </xsl:when>
  831. <xsl:otherwise>
  832. <!--<debug.447>-->
  833. <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>
  834. <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>
  835. <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response/wfs:FeatureCollection/@*"/>
  836. <xsl:apply-templates mode="#current" select="$get_wfs_recurse_xsl:wfs_response">
  837. <xsl:with-param name="p5:links.recurse_level" select="$p5:links.recurse_level"/> <!-- +1 -->
  838. <xsl:with-param name="p5:links.next.recurse_level" select=" number($p5:links.next.recurse_level) + 1"/>
  839. <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)"/>
  840. <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)"/>
  841. <xsl:with-param name="debug.last_wfs_request" select="$request_string"/>
  842. </xsl:apply-templates>
  843. <!--</debug.447>-->
  844. </xsl:otherwise>
  845. </xsl:choose>
  846. </xsl:otherwise>
  847. </xsl:choose>
  848. <!--</xsl:copy>-->
  849. </xsl:template>
  850. <xsl:template match="wfs:FeatureCollection[not(gml:featureMember/*)]" mode="p5:links.evaluate" >
  851. <xsl:message>#461 finished digging at <xsl:value-of select="@next"/></xsl:message>
  852. </xsl:template>
  853. <xsl:template match="wfs:FeatureCollection[@next and gml:featureMember/*]" mode="p5:links.evaluate" >
  854. <xsl:param name="p5:links.recurse_level" select="1"/>
  855. <xsl:param name="p5:links.next.recurse_level" select="1"/>
  856. <xsl:param name="get_wfs_recurse_xsl:context.PRIMARYKEY" required="yes"/>
  857. <xsl:param name="get_wfs_recurse_xsl:context.nodes" required="yes"/>
  858. <xsl:param name="debug.last_wfs_request" required="yes"/>
  859. <xsl:variable name="php_session_id_ok.string">
  860. <xsl:if test=" string-length($php_session_id_ok.string) &gt; 0">
  861. <xsl:value-of select="concat('&amp;sid=',normalize-space($php_session_id_ok.string))"/>
  862. </xsl:if>
  863. </xsl:variable>
  864. <xsl:variable name="MAXFEATURES.request">
  865. <xsl:choose>
  866. <xsl:when test="contains(@next,'&amp;maxFeatures=10')">
  867. <xsl:value-of select="concat('&amp;maxFeatures=',$MAXFEATURES)"/>
  868. </xsl:when>
  869. <xsl:when test="contains(@next,'&amp;maxFeatures=20')">
  870. <xsl:value-of select="concat('&amp;maxFeatures=',$MAXFEATURES)"/>
  871. </xsl:when>
  872. <xsl:when test="contains(@next,'maxFeatures')"/>
  873. <xsl:otherwise><xsl:value-of select="concat('&amp;maxFeatures=',$MAXFEATURES)"/></xsl:otherwise>
  874. </xsl:choose>
  875. </xsl:variable>
  876. <xsl:variable name="request_string" select="concat(@next,$MAXFEATURES.request)"/>
  877. <!--<xsl:variable name="api_recurse.request">
  878. <xsl:choose>
  879. <xsl:when test="1=1"></xsl:when>
  880. <xsl:when test="$api_recurse">
  881. <xsl:value-of select="concat(@next,'&amp;resolveDepth=',$resolveDepth,'&amp;resolve=all')"/>
  882. </xsl:when>
  883. </xsl:choose>
  884. </xsl:variable>-->
  885. <xsl:variable name="p5:fid">
  886. <xsl:choose>
  887. <xsl:when test="contains(@next,'PRIMARYKEY=')">
  888. <xsl:apply-templates select="@next" mode="p5:fid"/>
  889. </xsl:when>
  890. <xsl:otherwise>
  891. <xsl:message>#833 cannot get PRIMARYKEY from Backreffed - check loop in another leaf from <xsl:value-of select="@next"/></xsl:message>
  892. <xsl:comment>#833 cannot get PRIMARYKEY from Backreffed - check loop in another leaf from <xsl:value-of select="@next"/></xsl:comment>
  893. </xsl:otherwise>
  894. </xsl:choose>
  895. </xsl:variable>
  896. <!-- ,'&amp;maxFeatures=999' -->
  897. <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>
  898. <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>
  899. <!--<request_string>
  900. <xsl:copy-of select="$request_string"/>
  901. </request_string>-->
  902. <xsl:choose>
  903. <xsl:when test="$get_wfs_recurse_xsl:context.nodes//*[@fid = current()/@fid ]">
  904. <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>
  905. <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>
  906. </xsl:when>
  907. <xsl:when test="number($p5:links.recurse_level) &gt; $p5:links.recurse_level.limit">
  908. <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>
  909. <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>
  910. </xsl:when>
  911. <xsl:when test="number($p5:links.next.recurse_level) &gt; $p5:links.next.recurse_level.limit">
  912. <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>
  913. <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>
  914. </xsl:when>
  915. <xsl:otherwise>
  916. <xsl:comment>debug.current lower; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:comment>
  917. <xsl:apply-templates mode="#current">
  918. <xsl:with-param name="p5:links.recurse_level" select="number($p5:links.recurse_level) + 1"/>
  919. <xsl:with-param name="p5:links.next.recurse_level" select="$p5:links.next.recurse_level"/>
  920. <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:context.nodes"/>
  921. <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)"/>
  922. <xsl:with-param name="debug.last_wfs_request" select="$debug.last_wfs_request"/>
  923. </xsl:apply-templates>
  924. <xsl:comment>debug.current upper / debug.reffered lower; debug.last_wfs_request=<xsl:value-of select="$debug.last_wfs_request"/>;</xsl:comment>
  925. <xsl:choose>
  926. <xsl:when test="$get_wfs_recurse_xsl:context.PRIMARYKEY//*[@fid = $p5:fid]">
  927. <xsl:message>#797 detected FUTURE LOOP for fid=<xsl:value-of select="$p5:fid"/> in match="wfs:FeatureCollection[@next </xsl:message>
  928. </xsl:when>
  929. <xsl:otherwise>
  930. <xsl:variable name="get_wfs_recurse_xsl:wfs_response" select="doc($request_string)"/>
  931. <xsl:choose>
  932. <xsl:when test="$get_wfs_recurse_xsl:wfs_response//gml:featureMember/*">
  933. <xsl:apply-templates mode="#current" select="$get_wfs_recurse_xsl:wfs_response">
  934. <xsl:with-param name="p5:links.recurse_level" select="number($p5:links.recurse_level)"/> <!-- + 1 -->
  935. <xsl:with-param name="p5:links.next.recurse_level" select="number($p5:links.next.recurse_level) + 1"/>
  936. <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)"/>
  937. <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)"/>
  938. <xsl:with-param name="debug.last_wfs_request" select="$debug.last_wfs_request"/>
  939. </xsl:apply-templates>
  940. </xsl:when>
  941. <xsl:otherwise>
  942. <xsl:message>#498 not any childs</xsl:message>
  943. </xsl:otherwise>
  944. </xsl:choose>
  945. </xsl:otherwise>
  946. </xsl:choose>
  947. <!--</debug_reffered>-->
  948. <!--</debug.470>-->
  949. </xsl:otherwise>
  950. </xsl:choose>
  951. </xsl:template>
  952. <xsl:template match="wfs:FeatureCollection" mode="p5:links.evaluate" >
  953. <xsl:param name="p5:links.recurse_level" select="1"/>
  954. <xsl:param name="p5:links.next.recurse_level" select="1"/>
  955. <xsl:param name="get_wfs_recurse_xsl:context.nodes" required="yes"/>
  956. <xsl:param name="get_wfs_recurse_xsl:context.PRIMARYKEY" required="yes"/>
  957. <xsl:param name="debug.last_wfs_request" required="yes"/>
  958. <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>
  959. <xsl:apply-templates mode="#current">
  960. <xsl:with-param name="p5:links.recurse_level" select="(number($p5:links.recurse_level) + 1)"/>
  961. <xsl:with-param name="p5:links.next.recurse_level" select="$p5:links.next.recurse_level"/>
  962. <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:context.nodes"/>
  963. <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
  964. <xsl:with-param name="debug.last_wfs_request" select="$debug.last_wfs_request"/>
  965. </xsl:apply-templates>
  966. </xsl:template>
  967. <xsl:template match="gml:featureMember" mode="p5:links.evaluate">
  968. <xsl:param name="p5:links.recurse_level" select="1"/>
  969. <xsl:param name="p5:links.next.recurse_level" select="1"/>
  970. <xsl:param name="get_wfs_recurse_xsl:context.nodes" required="yes"/>
  971. <xsl:param name="get_wfs_recurse_xsl:context.PRIMARYKEY" required="yes"/>
  972. <xsl:param name="debug.last_wfs_request" required="yes"/>
  973. <xsl:apply-templates mode="#current">
  974. <xsl:with-param name="p5:links.recurse_level" select="$p5:links.recurse_level"/>
  975. <xsl:with-param name="p5:links.next.recurse_level" select="$p5:links.next.recurse_level"/>
  976. <xsl:with-param name="get_wfs_recurse_xsl:context.nodes" select="$get_wfs_recurse_xsl:context.nodes"/>
  977. <xsl:with-param name="get_wfs_recurse_xsl:context.PRIMARYKEY" select="$get_wfs_recurse_xsl:context.PRIMARYKEY"/>
  978. <xsl:with-param name="debug.last_wfs_request" select="$debug.last_wfs_request"/>
  979. </xsl:apply-templates>
  980. </xsl:template>
  981. <!--<xsl:template match="RelatedFeature" mode="get_wfs_recurse_xsl:wfs_response">
  982. <xsl:param name="get_wfs_recurse_xsl:wfs_response" required="yes"/>
  983. <xsl:apply-templates mode="get_wfs_recurse_xsl:wfs_response">
  984. <xsl:with-param name="get_wfs_recurse_xsl:wfs_response" select="$get_wfs_recurse_xsl:wfs_response"/>
  985. </xsl:apply-templates>
  986. </xsl:template>-->
  987. <!--<xsl:template match="simpleTypeMakeOgcFilter|RelatedFilter" mode="get_wfs_recurse_xsl:wfs_response"/>-->
  988. <!--<xsl:template match="*" mode="get_wfs_recurse_xsl:wfs_response">
  989. <xsl:param name="get_wfs_recurse_xsl:wfs_response" required="yes"/>
  990. <xsl:apply-templates mode="get_wfs_recurse_xsl:wfs_response_simpleType" select="$get_wfs_recurse_xsl:wfs_response"/>
  991. <xsl:apply-templates mode="get_wfs_recurse_xsl:wfs_response_RelatedFeature">
  992. <xsl:with-param name="get_wfs_recurse_xsl:wfs_response" select="$get_wfs_recurse_xsl:wfs_response"/>
  993. </xsl:apply-templates>
  994. </xsl:template>-->
  995. <xsl:template mode="get_wfs_recurse_xsl:wfs_response_RelatedFeature" match="RelatedFeature">
  996. <!--<xsl:param name="get_wfs_recurse_xsl:wfs_response" required="yes"/>-->
  997. <xsl:param name="get_wfs_recurse_xsl:typeNameRealResource" select="@typeNameRealResource"/>
  998. <xsl:param name="input_obj_with_xpath" required="yes"/>
  999. <!--<xsl:param name="xpath" select="$xpath"/>-->
  1000. <!--<xsl:param name="xpath_value" select="$xpath_value"/>-->
  1001. <!--<xsl:variable name="input_obj_with_xpath">
  1002. <xsl:apply-templates mode="after_first_ant_assing_xpath" select="node()/*"/> <!-\- zeby nie wstawial do xpath nazwy feature - IN7_DZIENNIK_KORESP/ID itp -\->
  1003. </xsl:variable>-->
  1004. <xsl:variable name="xpath_dita" select="get_wfs_recurse_xsl:xpath_dita('',@xpath)"/>
  1005. <xsl:variable name="xpath_value_dita" select="get_wfs_recurse_xsl:xpath_value_dita(@xpath,@xpath_value,$input_obj_with_xpath)"/>
  1006. <!--<xsl:variable name="get_wfs_recurse_xsl:GetsimpleSchema" select="get_wfs_recurse_xsl:GetsimpleSchema($typeName)"/>-->
  1007. <xsl:variable name="get_wfs_recurse_xsl:simpleTypeMakeOgcFilter" select="simpleTypeMakeOgcFilter"/>
  1008. <xsl:variable name="get_wfs_recurse_xsl:RelatedFilter" select="RelatedFilter"/>
  1009. <xsl:variable name="OGC_Filter">
  1010. <xsl:call-template name="simpleTypeMakeOgcFilter_merge">
  1011. <xsl:with-param name="simpleTypeMakeOgcFilter" select="$get_wfs_recurse_xsl:simpleTypeMakeOgcFilter"/>
  1012. <xsl:with-param name="RelatedFilter" select="$get_wfs_recurse_xsl:RelatedFilter"/>
  1013. <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
  1014. <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
  1015. <!-- <xsl:with-param name="get_wfs_recurse_xsl:xpath_dita" select="$xpath_dita"/>
  1016. <xsl:with-param name="get_wfs_recurse_xsl:xpath_value_dita" select="$xpath_value_dita"/>-->
  1017. </xsl:call-template>
  1018. </xsl:variable>
  1019. <!--<input_obj_with_xpath><xsl:copy-of select="$input_obj_with_xpath"/></input_obj_with_xpath>-->
  1020. <xsl:if test="$debug &gt; 4">
  1021. <xpath_dita>
  1022. <xsl:value-of select="$xpath_dita"/>/@xpath_value: <xsl:value-of select="@xpath_value"/>
  1023. </xpath_dita>
  1024. <xpath_value_dita>
  1025. <xsl:value-of select="$xpath_value_dita"></xsl:value-of>
  1026. </xpath_value_dita>
  1027. <!-- <get_wfs_recurse_xsl:simpleTypeMakeOgcFilter>
  1028. <xsl:copy-of select="$get_wfs_recurse_xsl:simpleTypeMakeOgcFilter"/>
  1029. </get_wfs_recurse_xsl:simpleTypeMakeOgcFilter>
  1030. <Filter>
  1031. <xsl:copy-of select="$OGC_Filter"/>
  1032. </Filter>-->
  1033. </xsl:if>
  1034. <!--<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 -->
  1035. <xsl:variable name="request_string">
  1036. <xsl:call-template name="get_wfs_recurse_xsl:request_string">
  1037. <xsl:with-param name="OGC_Filter" select="$OGC_Filter"/>
  1038. <xsl:with-param name="REQUEST.TYPE" select="'GetFeature'"/>
  1039. <xsl:with-param name="REQUEST.TYPENAME" select="$get_wfs_recurse_xsl:typeNameRealResource"/>
  1040. </xsl:call-template>
  1041. </xsl:variable>
  1042. <!--<xsl:variable name="url_string" select="concat($protocol,$username,':',$username.pass,'@',$api,'/',$targetNamespace_DEFAULTS_prefix,'/',$request_string)"/>-->
  1043. <xsl:variable name="get_wfs_recurse_xsl:wfs_response" select="doc($request_string)"/>
  1044. <xsl:if test="$debug &gt; 5">
  1045. <wfs_response>
  1046. <request>Retrieving <xsl:value-of select="$request_string"/></request>
  1047. <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>
  1048. <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>
  1049. <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response//gml:featureMember[1]"/>
  1050. </wfs_response>
  1051. </xsl:if>
  1052. <xsl:apply-templates mode="after_first_ant_assing_vars" select="." >
  1053. <xsl:with-param name="get_wfs_recurse_xsl:wfs_response" select="$get_wfs_recurse_xsl:wfs_response"/>
  1054. </xsl:apply-templates>
  1055. </xsl:template>
  1056. <xsl:template mode="get_wfs_recurse_xsl:wfs_response_RelatedFeatureLoop" match="RelatedFeature">
  1057. <!--<xsl:param name="get_wfs_recurse_xsl:wfs_response" required="yes"/>-->
  1058. <xsl:param name="get_wfs_recurse_xsl:typeNameRealResource" select="@typeNameRealResource"/>
  1059. <xsl:param name="input_obj_with_xpath" required="yes"/>
  1060. <xsl:param name="xpath" select="$xpath"/>
  1061. <xsl:param name="xpath_value" select="$xpath_value"/>
  1062. <!--<xsl:variable name="input_obj_with_xpath">
  1063. <xsl:apply-templates mode="after_first_ant_assing_xpath" select="node()/*"/> <!-\- zeby nie wstawial do xpath nazwy feature - IN7_DZIENNIK_KORESP/ID itp -\->
  1064. </xsl:variable>-->
  1065. <xsl:variable name="xpath_dita" select="get_wfs_recurse_xsl:xpath_dita('',$xpath)"/>
  1066. <xsl:variable name="xpath_value_dita" select="get_wfs_recurse_xsl:xpath_value_dita($xpath,$xpath_value,$input_obj_with_xpath)"/>
  1067. <!--<xsl:variable name="get_wfs_recurse_xsl:GetsimpleSchema" select="get_wfs_recurse_xsl:GetsimpleSchema($typeName)"/>-->
  1068. <xsl:variable name="get_wfs_recurse_xsl:simpleTypeMakeOgcFilter" select="simpleTypeMakeOgcFilter"/>
  1069. <xsl:variable name="get_wfs_recurse_xsl:RelatedFilter" select="RelatedFilter"/>
  1070. <xsl:variable name="OGC_Filter">
  1071. <xsl:call-template name="simpleTypeMakeOgcFilter_merge">
  1072. <xsl:with-param name="simpleTypeMakeOgcFilter" select="$get_wfs_recurse_xsl:simpleTypeMakeOgcFilter"/>
  1073. <xsl:with-param name="RelatedFilter" select="$get_wfs_recurse_xsl:RelatedFilter"/>
  1074. <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
  1075. <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
  1076. <!-- <xsl:with-param name="get_wfs_recurse_xsl:xpath_dita" select="$xpath_dita"/>
  1077. <xsl:with-param name="get_wfs_recurse_xsl:xpath_value_dita" select="$xpath_value_dita"/>-->
  1078. </xsl:call-template>
  1079. </xsl:variable>
  1080. <!--<input_obj_with_xpath><xsl:copy-of select="$input_obj_with_xpath"/></input_obj_with_xpath>-->
  1081. <xsl:if test="$debug &gt; 4">
  1082. <debug>
  1083. <xsl:attribute name="typeNameRealResource" select="@typeNameRealResource"/>
  1084. <xsl:attribute name="typeName" select="@typeName"/>
  1085. <xpath_dita>
  1086. <xsl:value-of select="$xpath_dita"/>/@xpath_value: <xsl:value-of select="@xpath_value"/>
  1087. </xpath_dita>
  1088. <xpath_value_dita>
  1089. <xsl:value-of select="$xpath_value_dita"></xsl:value-of>
  1090. </xpath_value_dita>
  1091. </debug>
  1092. </xsl:if>
  1093. <!-- <get_wfs_recurse_xsl:simpleTypeMakeOgcFilter>
  1094. <xsl:copy-of select="$get_wfs_recurse_xsl:simpleTypeMakeOgcFilter"/>
  1095. </get_wfs_recurse_xsl:simpleTypeMakeOgcFilter>
  1096. <Filter>
  1097. <xsl:copy-of select="$OGC_Filter"/>
  1098. </Filter>-->
  1099. <!--<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 -->
  1100. <xsl:variable name="request_string">
  1101. <xsl:call-template name="get_wfs_recurse_xsl:request_string">
  1102. <xsl:with-param name="OGC_Filter" select="$OGC_Filter"/>
  1103. <xsl:with-param name="REQUEST.TYPE" select="'GetFeature'"/>
  1104. <xsl:with-param name="REQUEST.TYPENAME" select="$get_wfs_recurse_xsl:typeNameRealResource"/>
  1105. </xsl:call-template>
  1106. </xsl:variable>
  1107. <!--<xsl:variable name="url_string" select="concat($protocol,$username,':',$username.pass,'@',$api,'/',$targetNamespace_DEFAULTS_prefix,'/',$request_string)"/>-->
  1108. <xsl:variable name="get_wfs_recurse_xsl:wfs_response" select="doc($request_string)"/>
  1109. <xsl:if test="$debug &gt; 4">
  1110. <wfs_response>
  1111. <request>Retrieving <xsl:value-of select="$request_string"/></request>
  1112. <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>
  1113. <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>
  1114. <!-- <debug_child_loop>-->
  1115. <!--<xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response"/>-->
  1116. <!--</debug_child_loop>-->
  1117. <!--<xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response"/>-->
  1118. </wfs_response>
  1119. </xsl:if>
  1120. <xsl:apply-templates mode="after_first_ant_assing_vars" select="." >
  1121. <xsl:with-param name="get_wfs_recurse_xsl:wfs_response" select="$get_wfs_recurse_xsl:wfs_response"/>
  1122. </xsl:apply-templates>
  1123. </xsl:template>
  1124. <xsl:template mode="get_wfs_recurse_xsl:wfs_response_simpleType" match="*">
  1125. <xsl:copy-of select="."/>
  1126. </xsl:template>
  1127. <xsl:template match="wfs:FeatureCollection">
  1128. <xsl:apply-templates/>
  1129. </xsl:template>
  1130. <xsl:template match="gml:featureMember">
  1131. <xsl:apply-templates mode="gml:featureMember"/>
  1132. </xsl:template>
  1133. <xsl:template match="*" mode="gml:featureMember">
  1134. <!-- TODO parse from prefx requested type -->
  1135. </xsl:template>
  1136. <!-- xpath -->
  1137. <xsl:template match="text()|comment()" mode="after_first_ant_assing_vars"/>
  1138. <xsl:template match="RelatedFeature" mode="after_first_ant_assing_vars">
  1139. <xsl:param name="loop_xpath" />
  1140. <xsl:param name="get_wfs_recurse_xsl:wfs_response" required="yes"/>
  1141. <!--<RelatedFeatureRoot>-->
  1142. <!-- first assign xpath to features from -->
  1143. <xsl:variable name="wfs_output_nodes" select="$get_wfs_recurse_xsl:wfs_response"/>
  1144. <xsl:variable name="current_RelatedFeature" select="*"/>
  1145. <xsl:variable name="xml_id" select="@xml_id"/>
  1146. <xsl:variable name="feature_pos_parent" select="@feature_pos"/>
  1147. <xsl:if test="$debug &gt; 2"><xsl:message>
  1148. {+}{+}{+}{+}{+}{+}{+}{+}{+}{+} #354 count($wfs_output_nodes//gml:featureMember) <xsl:value-of select="count($wfs_output_nodes//gml:featureMember)"/></xsl:message></xsl:if>
  1149. <!-- tutaj jest blad przetwarzania ze wrzuca po rekordzie do kolumny - trzeba przetworzyc dla kazdego feature member -->
  1150. <xsl:for-each select="$wfs_output_nodes//gml:featureMember">
  1151. <!--<wfs_record>
  1152. <xsl:copy-of select="."/>
  1153. </wfs_record>-->
  1154. <xsl:variable name="input_obj_with_xpath">
  1155. <xsl:apply-templates mode="after_first_ant_assing_xpath" select="node()/*"/> <!-- zeby nie wstawial do xpath nazwy feature - IN7_DZIENNIK_KORESP/ID itp -->
  1156. </xsl:variable>
  1157. <xsl:variable name="input_obj_fid" select="*"/> <!-- dla wykrycia @fid -->
  1158. <xsl:apply-templates mode="after_first_ant_assing_vars_childs" select="$current_RelatedFeature">
  1159. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  1160. <xsl:with-param name="xml_id_parent" select="$xml_id"/>
  1161. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  1162. <xsl:with-param name="feature_pos" select="position()"/><!-- wiecej features z relacji dokladamy pozycje -->
  1163. <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 -->
  1164. <xsl:with-param name="input_obj_fid" select="$input_obj_fid"/>
  1165. </xsl:apply-templates>
  1166. <!-- cache tasks ? -->
  1167. </xsl:for-each>
  1168. <!--</RelatedFeatureRoot>-->
  1169. </xsl:template>
  1170. <!--<xsl:template match="wfs:FeatureCollection|gml:featureMember" mode="after_first_ant_assing_xpath">
  1171. <xsl:apply-templates mode="after_first_ant_assing_xpath"/>
  1172. </xsl:template>-->
  1173. <xsl:template mode="after_first_ant_assing_xpath" match="*">
  1174. <xsl:param name="curr_xpath"/>
  1175. <xsl:param name="loop_xpath"/>
  1176. <xsl:choose>
  1177. <xsl:when test="name()=$typeName">
  1178. <xsl:apply-templates mode="after_first_ant_assing_xpath">
  1179. <xsl:with-param name="curr_xpath" select="$curr_xpath"/>
  1180. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  1181. </xsl:apply-templates>
  1182. </xsl:when>
  1183. <xsl:otherwise>
  1184. <xsl:variable name="curr_xpath_tmpl">
  1185. <xsl:choose>
  1186. <xsl:when test="$curr_xpath=''">
  1187. <xsl:value-of select="local-name()"/> <!-- bylo local-name() - trzeba dorzucic xpath przechodzacy aby budowal sie w kwestii -->
  1188. </xsl:when>
  1189. <xsl:otherwise>
  1190. <xsl:value-of select="concat($curr_xpath,'/',local-name())"/>
  1191. </xsl:otherwise>
  1192. </xsl:choose>
  1193. </xsl:variable>
  1194. <!--<xsl:variable name="curr_xpath_tmpl" select="'asdf'"/>-->
  1195. <!--<xsl:element name="{name()}" >-->
  1196. <xsl:copy>
  1197. <xsl:attribute name="xpath" select="$curr_xpath_tmpl"/>
  1198. <xsl:for-each select="@*">
  1199. <xsl:choose>
  1200. <xsl:when test="name()='fid'"/>
  1201. <xsl:otherwise><xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute></xsl:otherwise>
  1202. </xsl:choose>
  1203. </xsl:for-each>
  1204. <xsl:value-of select="text()"/>
  1205. <xsl:apply-templates mode="after_first_ant_assing_xpath">
  1206. <xsl:with-param name="curr_xpath" select="$curr_xpath_tmpl"/>
  1207. </xsl:apply-templates>
  1208. </xsl:copy>
  1209. <!--</xsl:element>-->
  1210. </xsl:otherwise>
  1211. </xsl:choose>
  1212. </xsl:template>
  1213. <xsl:template match="text()" mode="after_first_ant_assing_xpath"/>
  1214. <xsl:template match="simpleTypeMakeOgcFilter" mode="after_first_ant_assing_vars_childs">
  1215. <xsl:if test="$debug &gt; 2"><xsl:message>#621 bypassing simpleTypeMakeOgcFilter in after_first_ant_assing_vars_childs</xsl:message></xsl:if>
  1216. </xsl:template>
  1217. <!-- przetwarzanie kolejne w celu podstawienia wartosci i wystawienia build dla kolejnych wezlow - problem z obsluga rownorzednie zagniezdzonych wezlow poprzez inne wezly -->
  1218. <xsl:template match="*" mode="after_first_ant_assing_vars_childs">
  1219. <xsl:param name="xml_id_parent" required="yes"/>
  1220. <xsl:param name="loop_xpath" required="yes"/>
  1221. <xsl:param name="input_obj_with_xpath" required="yes"/>
  1222. <xsl:param name="feature_pos" required="yes"/>
  1223. <xsl:param name="feature_pos_parent" required="yes"/>
  1224. <xsl:param name="input_obj_fid" required="no"/>
  1225. <xsl:for-each select=".">
  1226. <xsl:choose>
  1227. <xsl:when test="1=2"/>
  1228. <xsl:otherwise>
  1229. <xsl:element name="{local-name()}">
  1230. <!--<xsl:if test="$input_obj_fid">
  1231. <!-\-<xsl:attribute name="input_obj_fid_name" select="$input_obj_fid/name()"/>-\->
  1232. <xsl:attribute name="fid" select="$input_obj_fid/@fid"/>
  1233. </xsl:if>-->
  1234. <!--<xsl:copy-of select="namespace::node()"/>-->
  1235. <xsl:for-each select="@*">
  1236. <xsl:choose>
  1237. <xsl:when test="name()='fid'"/>
  1238. <xsl:when test="name()='xml_id'"/>
  1239. <xsl:when test="name()='xpath'">
  1240. <!--<xsl:attribute name="xpath_parsed" select="."/>-->
  1241. <!--1:<xsl:value-of select="$parent_obj//node()[@system_cache__appinfo:xpath=$xpath]/text()"/>-->
  1242. <!--<xsl:value-of select="$parent_obj//node()[local-name()=$xpath]/text()"/>-->
  1243. <!--V:<xsl:value-of select="$xpath"/>-->
  1244. </xsl:when>
  1245. <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
  1246. </xsl:choose>
  1247. </xsl:for-each>
  1248. <xsl:choose>
  1249. <xsl:when test="@xpath">
  1250. <!--<xsl:variable name="enter_to_ph">-->
  1251. <xsl:choose>
  1252. <!--<xsl:when test="@xpath_token_filter and @xpath_token ">
  1253. <!-\- implementacja filtra dla czegos oddzielonego parametrem -\->
  1254. <xsl:variable name="xpath_token_filter" select="tokenize($input_obj_with_xpath/node()[local-name()=current()/@xpath],@xpath_token_filter)"/>
  1255. <xsl:for-each select=" tokenize(@xpath_token,' ')">
  1256. <xsl:variable name="xpath_token" select="number(.)"/>
  1257. <xsl:copy-of select="$xpath_token_filter[$xpath_token]"></xsl:copy-of>
  1258. </xsl:for-each>
  1259. </xsl:when>-->
  1260. <xsl:when test="$input_obj_with_xpath/node()[local-name()=current()/@xpath]/*">
  1261. <xsl:copy-of select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]/*"/>
  1262. </xsl:when>
  1263. <xsl:otherwise>
  1264. <xsl:copy-of select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]/text()"/>
  1265. </xsl:otherwise>
  1266. </xsl:choose>
  1267. <!--</xsl:variable>-->
  1268. <!--<xsl:copy-of select="$enter_to_ph"/>-->
  1269. </xsl:when>
  1270. </xsl:choose>
  1271. <!--<xsl:comment>#1938 value of text()</xsl:comment>-->
  1272. <!--XXXX <xsl:value-of select="text()"/>-->
  1273. <xsl:apply-templates mode="after_first_ant_assing_vars_childs">
  1274. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  1275. <xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>
  1276. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  1277. <xsl:with-param name="feature_pos" select="$feature_pos"/>
  1278. <xsl:with-param name="feature_pos_parent" select="$feature_pos_parent"/>
  1279. <xsl:with-param name="input_obj_fid" select="$input_obj_fid"/>
  1280. </xsl:apply-templates>
  1281. </xsl:element>
  1282. </xsl:otherwise>
  1283. </xsl:choose>
  1284. </xsl:for-each>
  1285. </xsl:template>
  1286. <xsl:template match="RelatedFeature" mode="after_first_ant_assing_vars_childs">
  1287. <xsl:if test="$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>
  1288. </xsl:template> <!-- to disable ignored maxOccurs=0 -->
  1289. <xsl:template match="RelatedFeature[not(@system_cache__appinfo:maxOccurs='0') or not($ignore_maxOccurs_0)]" mode="after_first_ant_assing_vars_childs">
  1290. <xsl:param name="input_obj_with_xpath" required="yes"/>
  1291. <xsl:param name="xml_id_parent" required="yes"/>
  1292. <xsl:param name="loop_xpath" />
  1293. <xsl:param name="feature_pos" required="yes"/>
  1294. <xsl:param name="feature_pos_parent" required="yes"/>
  1295. <xsl:param name="input_obj_fid" required="yes"/>
  1296. <xsl:param name="xpath_query"/> <!-- + added test -->
  1297. <xsl:if test="$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>
  1298. <!-- jest okazja do zrobienia bilda aby sciagnal rzeczy nizej -->
  1299. <xsl:variable name="featureID_name" select="substring-after(@typeName,':')"/>
  1300. <xsl:variable name="xml_id" select="@xml_id"/>
  1301. <xsl:variable name="loop_xpath" select="concat($loop_xpath,'/',$xml_id,'.',$feature_pos)"/> <!-- loop path too long ,'.',$featureID_name -->
  1302. <!--<xsl:variable name="loop_xpath_save" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>--> <!-- tutaj zapisal sie build z wezla z parent -->
  1303. <!--<debug_358_RelatedFeature>
  1304. <xsl:copy-of select="$input_obj_with_xpath"/>
  1305. </debug_358_RelatedFeature>-->
  1306. <!--<xsl:variable name="feature_pos">
  1307. <xsl:choose>
  1308. <xsl:when test="$feature_pos=1"/>
  1309. <xsl:otherwise><xsl:value-of select="$feature_pos"/></xsl:otherwise>
  1310. </xsl:choose>
  1311. </xsl:variable>-->
  1312. <xsl:variable name="test_xpath_query">
  1313. <xsl:call-template name="test_xpath_query">
  1314. <xsl:with-param name="featureID_name_dita" select="$featureID_name"/>
  1315. <xsl:with-param name="ignore_maxOccurs_0" select="$ignore_maxOccurs_0"/>
  1316. <xsl:with-param name="system_cache__appinfo:maxOccurs" select="@system_cache__appinfo:maxOccurs"/>
  1317. <xsl:with-param name="xpath_query" select="$xpath_query"/>
  1318. </xsl:call-template>
  1319. </xsl:variable>
  1320. <xsl:choose>
  1321. <xsl:when test="$test_xpath_query='1'">
  1322. <xsl:if test="$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>
  1323. <xsl:comment>#527 there we exec child dig</xsl:comment>
  1324. <!-- <xsl:element name="RelatedFeature">
  1325. <xsl:copy-of select="@*"/>
  1326. <xsl:attribute name="featureID_name" select="$featureID_name"/>
  1327. <xsl:attribute name="loop_xpath" select="$loop_xpath"/>
  1328. <xsl:attribute name="feature_pos" select="$feature_pos"/>
  1329. <xsl:attribute name="feature_pos_parent" select="$feature_pos_parent"/>
  1330. <xsl:attribute name="fid" select="$input_obj_fid/@fid"/>-->
  1331. <xsl:apply-templates mode="get_wfs_recurse_xsl:wfs_response_RelatedFeature" select=".">
  1332. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  1333. </xsl:apply-templates>
  1334. <!--</xsl:element>-->
  1335. </xsl:when>
  1336. <xsl:otherwise>
  1337. <xsl:if test="$debug &gt; 2"><xsl:message terminate="no">#389b
  1338. #
  1339. #
  1340. #
  1341. 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
  1342. #
  1343. #</xsl:message></xsl:if>
  1344. </xsl:otherwise>
  1345. </xsl:choose>
  1346. </xsl:template>
  1347. <xsl:template match="RelatedFeatureLoop" mode="after_first_ant_assing_vars_childs">
  1348. <xsl:if test="$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>
  1349. </xsl:template>
  1350. <xsl:template match="RelatedFeatureLoop[not(@system_cache__appinfo:maxOccurs='0') or not($ignore_maxOccurs_0)]" mode="after_first_ant_assing_vars_childs">
  1351. <xsl:param name="input_obj_with_xpath" required="yes"/>
  1352. <xsl:param name="xml_id_parent" required="yes"/>
  1353. <xsl:param name="loop_xpath" />
  1354. <xsl:param name="feature_pos" required="yes"/>
  1355. <xsl:param name="feature_pos_parent" required="yes"/>
  1356. <xsl:param name="input_obj_fid" required="yes"/>
  1357. <xsl:param name="xpath_query"/> <!-- + added test -->
  1358. <xsl:if test="$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>
  1359. <!-- jest okazja do zrobienia bilda aby sciagnal rzeczy nizej -->
  1360. <xsl:variable name="featureID_name" select="substring-after(@typeName,':')"/>
  1361. <xsl:variable name="xml_id" select="@xml_id"/>
  1362. <xsl:variable name="loop_xpath" select="concat($loop_xpath,'/',$xml_id,'.',$feature_pos)"/> <!-- loop path too long ,'.',$featureID_name -->
  1363. <!--<xsl:variable name="loop_xpath_save" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>--> <!-- tutaj zapisal sie build z wezla z parent -->
  1364. <!--<debug_358_RelatedFeature>
  1365. <xsl:copy-of select="$input_obj_with_xpath"/>
  1366. </debug_358_RelatedFeature>-->
  1367. <!--<xsl:variable name="feature_pos">
  1368. <xsl:choose>
  1369. <xsl:when test="$feature_pos=1"/>
  1370. <xsl:otherwise><xsl:value-of select="$feature_pos"/></xsl:otherwise>
  1371. </xsl:choose>
  1372. </xsl:variable>-->
  1373. <xsl:variable name="test_xpath_query">
  1374. <xsl:call-template name="test_xpath_query">
  1375. <xsl:with-param name="featureID_name_dita" select="$featureID_name"/>
  1376. <xsl:with-param name="ignore_maxOccurs_0" select="$ignore_maxOccurs_0"/>
  1377. <xsl:with-param name="system_cache__appinfo:maxOccurs" select="@system_cache__appinfo:maxOccurs"/>
  1378. <xsl:with-param name="xpath_query" select="$xpath_query"/>
  1379. </xsl:call-template>
  1380. </xsl:variable>
  1381. <xsl:choose>
  1382. <xsl:when test="$test_xpath_query='1'">
  1383. <xsl:if test="$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>
  1384. <xsl:comment>#527 there we exec child dig</xsl:comment>
  1385. <!-- <xsl:element name="RelatedFeature">
  1386. <xsl:copy-of select="@*"/>
  1387. <xsl:attribute name="featureID_name" select="$featureID_name"/>
  1388. <xsl:attribute name="loop_xpath" select="$loop_xpath"/>
  1389. <xsl:attribute name="feature_pos" select="$feature_pos"/>
  1390. <xsl:attribute name="feature_pos_parent" select="$feature_pos_parent"/>
  1391. <xsl:attribute name="fid" select="$input_obj_fid/@fid"/>-->
  1392. <xsl:comment>#710 opening new Loop recurse instance for <xsl:value-of select="@typeName"/></xsl:comment>
  1393. <xsl:apply-templates mode="get_wfs_recurse_xsl:wfs_response_RelatedFeatureLoop" select="get_wfs_recurse_xsl:GetsimpleSchema(@typeName)">
  1394. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  1395. <xsl:with-param name="xpath" select="@xpath"/>
  1396. <xsl:with-param name="xpath_value" select="@xpath_value"/>
  1397. </xsl:apply-templates>
  1398. <!--</xsl:element>-->
  1399. </xsl:when>
  1400. <xsl:otherwise>
  1401. <xsl:if test="$debug &gt; 2"><xsl:message terminate="yes">#389b
  1402. #
  1403. #
  1404. #
  1405. 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
  1406. #
  1407. #</xsl:message></xsl:if>
  1408. </xsl:otherwise>
  1409. </xsl:choose>
  1410. </xsl:template>
  1411. <xsl:template match="text()" mode="after_first_ant_assing_vars_childs"/>
  1412. <xsl:template match="comment()" mode="after_first_ant_assing_vars_childs"/>
  1413. <!-- pozbieranie do kupy wszystkich xmli i zlozenie dity -->
  1414. <xsl:template name="test_xpath_query">
  1415. <!-- to verify if retrieve some node based on user requested tree limit filter -->
  1416. <xsl:param name="ignore_maxOccurs_0" required="yes"/>
  1417. <xsl:param name="xpath_query" required="yes"/>
  1418. <xsl:param name="featureID_name_dita" required="yes"/>
  1419. <xsl:param name="system_cache__appinfo:maxOccurs" required="yes"/>
  1420. <xsl:if test="$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>
  1421. <xsl:if test="$ignore_maxOccurs_0"><xsl:if test="$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>
  1422. <xsl:variable name="TestMaxOccurs">
  1423. <xsl:choose>
  1424. <xsl:when test="$system_cache__appinfo:maxOccurs='0' and $ignore_maxOccurs_0"></xsl:when>
  1425. <xsl:otherwise><xsl:value-of select="1"/></xsl:otherwise>
  1426. </xsl:choose>
  1427. </xsl:variable>
  1428. <xsl:value-of select="$TestMaxOccurs"/>
  1429. </xsl:template>
  1430. <xsl:template match="RelatedFeatureRoot" mode="anonimize_for_devel">
  1431. <wfs:FeatureCollection>
  1432. <xsl:apply-templates mode="anonimize_for_devel.featureMember" />
  1433. </wfs:FeatureCollection>
  1434. </xsl:template>
  1435. <xsl:template match="*" mode="anonimize_for_devel.featureMember">
  1436. <gml:featureMember>
  1437. <xsl:copy copy-namespaces="no">
  1438. <xsl:copy-of select="@*"/>
  1439. <xsl:apply-templates mode="anonimize_for_devel.child"/>
  1440. </xsl:copy>
  1441. </gml:featureMember>
  1442. </xsl:template>
  1443. <xsl:template match="p5:links" mode="anonimize_for_devel.child"/>
  1444. <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">
  1445. <xsl:message>#1600 debug hidden name()=<xsl:value-of select="name()"/>;</xsl:message>
  1446. </xsl:template>
  1447. <xsl:template match="get_wfs_recurse_xsl:context.PRIMARYKEY|get_wfs_recurse_xsl:context.nodes" mode="anonimize_for_devel.child"/>
  1448. <xsl:template match="text()" mode="anonimize_for_devel.child"/>
  1449. <xsl:template match="comment()" mode="anonimize_for_devel.child">
  1450. <xsl:copy-of select="."/>
  1451. </xsl:template>
  1452. <xsl:template match="*" mode="anonimize_for_devel.child">
  1453. <xsl:copy copy-namespaces="no">
  1454. <xsl:copy-of select="@*"/>
  1455. <xsl:copy-of select="text()"/>
  1456. <xsl:apply-templates mode="#current"/>
  1457. </xsl:copy>
  1458. </xsl:template>
  1459. <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
  1460. 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">
  1461. <xsl:copy copy-namespaces="no">
  1462. <xsl:copy-of select="@*"/>
  1463. <xsl:value-of select="concat(substring(text(),1,2),'*****',string-length(text()))"/>
  1464. </xsl:copy>
  1465. </xsl:template>
  1466. </xsl:stylesheet>