get_wfs_recurse_xsl.xsl 106 KB

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