get_wfs_recurse_xsl.xsl 131 KB

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