get_wfs_recurse_xsl.xsl 128 KB

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