build_recurse_ant.xsl 86 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159
  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:gml="http://www.opengis.net/gml"
  5. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  6. xmlns:xlink="http://www.w3.org/1999/xlink"
  7. xmlns:p5_default_db="https://biuro.biall-net.pl/wfs/default_db"
  8. xmlns:wfs="http://www.opengis.net/wfs"
  9. xmlns:ogc="http://www.opengis.net/ogc"
  10. xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
  11. xmlns:p5_tr_map="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/procesy5_translate_map.xsd"
  12. exclude-result-prefixes="xs"
  13. version="2.0">
  14. <xsl:output indent="yes" />
  15. <xsl:strip-space elements="*"/>
  16. <!-- Copyright BIALL-NET sp. z o.o. 2017-03-01 by Arkadiusz Binder wszelkie prawa zastrzeżone -->
  17. <!-- @2017-03-01 modyfikacja dla potrzeb CRM_PROCES_tree - sa bledy-->
  18. <xsl:include href="escaped_html_to_xml.xsl"/>
  19. <!--
  20. <property name="url" value="${url}"/> - to point what is record/table to download
  21. <property name="uuid" value="${uuid}"/> it is automatically also set to enable uinque transaction and to allow to save data with user
  22. <property name="passwordBase64Basic" value="${passwordBase64Basic}"/> - this is also set - to enable communicate with API -
  23. <property name="DwebRootUrl" value="${$webRootUrl}"/> - this is the place where script is localized to easyli to target user GUI by href to generated output -->
  24. <!-- variables to be set first by GUI first_request from executing API (php -> bash)-->
  25. <xsl:param name="uuid" required="yes" /> <!-- pewnie bedziemy ignorowac i dzialac na bazie ${'wfs_output'} ktory juz jest tempfilem -->
  26. <xsl:param name="passwordBase64Basic" required="yes" />
  27. <xsl:param name="url" />
  28. <xsl:param name="webRootUrl" />
  29. <xsl:param name="basedir" required="yes"/> <!-- aktualny katalog gdzie znajduja sie pliki temp -->
  30. <!--<xsl:param name="out_task.dita"/>--> <!-- nazwa temp docelowego zrodla do wykonania pliku pdf -->
  31. <!--<xsl:param name="current_leaf.dita" required="yes"/>--> <!-- nazwa aktualnego przetowarzenia .dita - najpierw main_build_recurse_ant.dita potem przechodzi w 1.1.root_x2f_IN7_DZIENNIK_KORESP.1.dita.xml -->
  32. <!--<xsl:param name="wfs_output" select="concat('temp/wfs_output.',$uuid)"/>-->
  33. <!-- jak parametr jest to znaczy, ze przetwarzamy -->
  34. <xsl:param name="wfs_output" required="no"/> <!-- potem wfs_output.xml jak sciagnie nazwa temp sciagniecia z api xml forsowana przez pierwsze sciagniecie -->
  35. <xsl:param name="api_url" required="yes"/>
  36. <!--<xsl:param name="namespace_prefix" select="'p5_default_db'"/>-->
  37. <xsl:param name="typeName" required="yes" /> <!-- to be set initially ex: p5_default_db:IN7_DZIENNIK_KORESP -->
  38. <xsl:param name="xpath" required="yes" /> <!-- to be set initially ex: ID -->
  39. <xsl:param name="xpath_value" required="yes" /> <!-- to be set ex: 1000 -->
  40. <xsl:param name="loop_xpath" required="yes"/> <!-- sciezka do zapisywania xmli w przetwarzaniu plikow default root -->
  41. <xsl:param name="loop_xpath_save" required="yes"/> <!-- przekazany z template match="RelatedFeature" mode="after_first_ant_assing_vars_childs" -->
  42. <!-- static project variables as default styles.dita/xsl and names-->
  43. <xsl:param name="main_build_recurse_ant.dita" select="'main_build_recurse_ant.dita'"/>
  44. <xsl:param name="xml_id_parent" select="@xml_id"/>
  45. <xsl:param name="build_recurse_ant.xsl" required="yes"/>
  46. <xsl:param name="temp" required="yes"/>
  47. <xsl:param name="builds_to_ant.xsl" required="yes"/>
  48. <xsl:param name="cookie_curl_option" required="yes"/>
  49. <xsl:param name="loop_path_recurs" required="yes" /> <!-- loop path dla gromadzenia plikow dla RelatedFeatureLoop do przetworzen w rekurencji - domysmnie pusty, potem sie dobudowuje po wyzwoleniu anta w glab -->
  50. <!-- second step fist loop - with data -->
  51. <!--<xsl:param name="wfs_output.xml"/>--> <!-- to be set in second step by ant build generated by this style to fill by its data childs -->
  52. <!-- opis dzialania template dla przetwarzania wezlow na podstawie schematu i budowania zagniezdzonego pliku xml z
  53. instancjami na podstawie tego samego schematu
  54. wyzwolenie inicjalizujace z build.xml buduje "wyzwolenie glowne" gdzie na output daje wynikowy build.
  55. system wyzwala dwa etapy
  56. wyzwolenie glowne - do okreslenia zaleznosci wezla i zbudowania zapytania o dane
  57. wyzwolenie after_first_ant_assing_vars - do podstawienia danych z wyzwolenia poprzedniego oraz przygotowania build "dla kolejnego X" do wyzwolenia glownego
  58. wyzwolenie glowne - szuka pierwszego RelatedFeature, ktore zawsze domyslnie jest na poczatku template, potem w nim grzebie - jak znajdzie - wchodzi w dol
  59. w ramach tego wyzwolenia przygotowuje task dla biezecego przygotowania ant_build - mode ant_target
  60. w ramach tego wyzwolenia juz musi przeanalizowac jakie sa dalsze zadania do wyzwolenia "dla kolejnego X' ant_build -
  61. mode place_subant (jest okazja do zrobienia builda) do poprawy zagniezdzenia - co robi na podstawie szukania plikow w kontekscie wyzwolenia after_first_ant_assing_vars
  62. wyzwolenie after_first_ant_assing_vars - to wyzwile
  63. to wyzwolenie podstawia dane do dita.vals.xml w celu zlozenia pliku wyjsciowego
  64. to wyzwolenie powinno juz zrobic ant_buildy "dla kolejnego X'
  65. to wyzwolenie korzysta z apply-templates wyzwolenia glownego, w celu przygotowania ant_build
  66. -->
  67. <xsl:template match="*">
  68. <xsl:param name="typeName" select="$typeName" />
  69. <xsl:param name="xpath" select="$xpath" />
  70. <xsl:param name="xpath_value" select="$xpath_value" />
  71. <xsl:param name="loop_xpath" select="$loop_xpath"/>
  72. <xsl:param name="loop_xpath_save" select="$loop_xpath_save"/><!-- tutaj zapisal sie build z wezla z parent -->
  73. <xsl:param name="input_obj_with_xpath" /> <!-- przekazany z template match="RelatedFeature" mode="after_first_ant_assing_vars_childs" -->
  74. <xsl:param name="feature_pos" select="1"/> <!-- przekazany z template match="RelatedFeature" mode="after_first_ant_assing_vars_childs"-->
  75. <xsl:param name="loop_path_recurs" select="$loop_path_recurs"/> <!-- przekazany z RelatedFeatureLoop z mode="after_first_ant_assing_vars_childs" -->
  76. <xsl:choose>
  77. <xsl:when test="name()='RelatedFeature'">
  78. <xsl:variable name="RelatedFeatureCount" select="last()"/>
  79. <xsl:variable name="RelatedFeaturePos" select="position()"/>
  80. <xsl:variable name="featureID_name" select="substring-after($typeName,':')"/>
  81. <xsl:message>#58 bylo $loop_xpath=<xsl:value-of select="$loop_xpath"/>; $basedir=<xsl:value-of select="$basedir"/>; </xsl:message>
  82. <xsl:variable name="loop_xpath_real" select="$loop_xpath"/>
  83. <xsl:variable name="loop_xpath">
  84. <xsl:choose>
  85. <xsl:when test="$loop_xpath='root'">
  86. <xsl:value-of select="concat($loop_xpath,'_x2f_.',@xml_id,'.',$featureID_name)"/>
  87. </xsl:when>
  88. <xsl:otherwise><xsl:value-of select="$loop_xpath"/></xsl:otherwise>
  89. </xsl:choose>
  90. </xsl:variable>
  91. <xsl:variable name="typeName_dita" select="@typeName"/>
  92. <xsl:variable name="featureID_name_dita" select="substring-after($typeName_dita,':')"/>
  93. <xsl:variable name="xml_id" select="@xml_id"/>
  94. <!--<xsl:variable name="wfs_output" select="concat($uuid,'.',$loop_xpath,'_x2f_',$featureID_name)"/>-->
  95. <xsl:variable name="wfs_output" select="concat($uuid,'.',$loop_xpath)"/>
  96. <!--<xsl:variable name="wfs_output.xml" select="concat($wfs_output,'.',position(),'.xml')"/>-->
  97. <xsl:variable name="wfs_output.xml" select="concat($wfs_output,'.',position(),'.',$feature_pos,'.xml')"/>
  98. <xsl:variable name="wfs_output.dita" select="concat($wfs_output,'.',position(),'.',$feature_pos,'.dita.xml')"/>
  99. <!--<xsl:variable name="wfs_output.dita" select="concat($wfs_output,'.',position(),'.','.dita.xml')"/>-->
  100. <!-- dane z oczekiwanego template .dita -->
  101. <xsl:variable name="xpath_dita">
  102. <xsl:choose>
  103. <xsl:when test=" string-length($xpath) &gt;0">
  104. <xsl:value-of select="$xpath"/>
  105. <xsl:message>#121 narzucam $xpath=(<xsl:value-of select="$xpath"/>) z wyzwolenia build.xml </xsl:message>
  106. </xsl:when>
  107. <xsl:otherwise><xsl:value-of select="@xpath"/></xsl:otherwise>
  108. </xsl:choose>
  109. </xsl:variable>
  110. <xsl:variable name="xpath_value_dita">
  111. <xsl:choose>
  112. <xsl:when test="string-length($xpath_value) &gt;0">
  113. <xsl:message>#67.0 $xpath_value=(<xsl:value-of select="$xpath_value"/>); narzucone pewnie z wyzwolenia build.xml</xsl:message>
  114. <xsl:value-of select="$xpath_value"/>
  115. </xsl:when>
  116. <xsl:when test="@xpath_value">
  117. <!--<xsl:variable name="xpath_value_tokens" select="tokenize(@xpath_value,'/')"/>-->
  118. <!--<xsl:value-of select="'todo zapytanie xpath do przetworzenia'"/>-->
  119. <!--<xsl:copy-of select="$xpath_value_tokens"></xsl:copy-of>-->
  120. <!--<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>-->
  121. <xsl:message>#67.1 $input_obj_with_xpath: <xsl:copy-of select="$input_obj_with_xpath"/> </xsl:message>
  122. <!--<xsl:variable name="xpath_value_token">-->
  123. <xsl:call-template name="xpath_filter_apply">
  124. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  125. <xsl:with-param name="xpath" select="@xpath"/>
  126. <xsl:with-param name="xpath_value" select="@xpath_value"/>
  127. </xsl:call-template>
  128. <!--</xsl:variable>-->
  129. <!--<xsl:message>#73 ustalam na <xsl:value-of select="$xpath_value_token/node()[1]/text()"/>;</xsl:message>-->
  130. <!--<xsl:value-of select="$xpath_value_token/node()[1]/text()"/>-->
  131. <!--<xsl:value-of select="$xpath_value_token"/>-->
  132. </xsl:when>
  133. <xsl:otherwise>
  134. <xsl:value-of select="$xpath_value"/><!-- parametr z template narzuca wartosc -->
  135. </xsl:otherwise>
  136. </xsl:choose>
  137. </xsl:variable>
  138. <xsl:message>#71 wstawiam projekt $feature_pos=<xsl:value-of select="$feature_pos"/>; $loop_xpath=<xsl:value-of select="$loop_xpath"/>; </xsl:message>
  139. <project basedir="../." name="get_related_feature{$loop_xpath_real}" default="get_related_feature_run_child_ant{$loop_xpath_real}">
  140. <xsl:comment>RelatedFeatureCount:<xsl:value-of select="count(*)"/></xsl:comment>
  141. <echo> ANT Uruchamiam $feature_pos=<xsl:value-of select="$feature_pos"/>; projekt <xsl:value-of select="$loop_xpath_real"/>; </echo>
  142. <!--<xsl:variable name="typeName" select='replace($typeName,"&quot;","")'/>--><!-- oczyszczenie z apostrofow -->
  143. <xsl:element name="property">
  144. <xsl:attribute name="name" select="'uuid'"/>
  145. <xsl:attribute name="value" select="$uuid"/>
  146. </xsl:element>
  147. <xsl:element name="property">
  148. <xsl:attribute name="name" select="'passwordBase64Basic'"/>
  149. <xsl:attribute name="value" select="$passwordBase64Basic"/>
  150. </xsl:element>
  151. <xsl:element name="property">
  152. <xsl:attribute name="name" select="'php_session_id'"/>
  153. <xsl:attribute name="value" select="$cookie_curl_option"/>
  154. </xsl:element>
  155. <xsl:element name="property">
  156. <xsl:attribute name="name" select="'url'"/>
  157. <xsl:attribute name="value" select="$url"/>
  158. </xsl:element>
  159. <xsl:element name="property">
  160. <xsl:attribute name="name" select="'webRootUrl'"/>
  161. <xsl:attribute name="value" select="$webRootUrl"/>
  162. </xsl:element>
  163. <xsl:element name="property">
  164. <xsl:attribute name="name" select="'build_recurse_ant.xsl'"/>
  165. <xsl:attribute name="value" select="$build_recurse_ant.xsl"/>
  166. </xsl:element>
  167. <xsl:element name="property">
  168. <xsl:attribute name="name" select="'temp'"/>
  169. <xsl:attribute name="value" select="$temp"/>
  170. </xsl:element>
  171. <xsl:element name="property">
  172. <xsl:attribute name="name" select="'builds_to_ant.xsl'"/>
  173. <xsl:attribute name="value" select="$builds_to_ant.xsl"/>
  174. </xsl:element>
  175. <xsl:element name="property">
  176. <xsl:attribute name="name" select="'loop_path_recurs'"/>
  177. <xsl:attribute name="value" select="$loop_path_recurs"/>
  178. </xsl:element>
  179. <xsl:comment>
  180. Important variables:
  181. typeName=<xsl:value-of select="$typeName"/>;
  182. xpath=<xsl:value-of select="$xpath"/>;
  183. xpath_value=<xsl:value-of select="$xpath_value"/>;
  184. $passwordBase64Basic=<xsl:value-of select="$passwordBase64Basic"/>
  185. </xsl:comment>
  186. <xsl:apply-templates mode="ant_target" select=".">
  187. <xsl:with-param name="typeName_dita" select="$typeName_dita"/>
  188. <xsl:with-param name="featureID_name_dita" select="$featureID_name_dita"/>
  189. <xsl:with-param name="wfs_output" select="$wfs_output"/>
  190. <xsl:with-param name="wfs_output.xml" select="$wfs_output.xml"/>
  191. <xsl:with-param name="wfs_output.dita" select="$wfs_output.dita"/>
  192. <xsl:with-param name="xpath" select="$xpath"/>
  193. <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
  194. <xsl:with-param name="featureID_name" select="$featureID_name"/>
  195. <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
  196. <xsl:with-param name="RelatedFeatureCount" select="$RelatedFeatureCount"/>
  197. <xsl:with-param name="RelatedFeaturePos" select="$RelatedFeaturePos"/>
  198. <xsl:with-param name="typeName" select="$typeName"/>
  199. <xsl:with-param name="xpath_value" select="$xpath_value"/>
  200. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  201. <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
  202. <!--<xsl:with-param name="loop_xpath_save" select="$loop_xpath_save"/>-->
  203. <xsl:with-param name="xml_id" select="$xml_id"/>
  204. <!--<xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>-->
  205. <xsl:with-param name="feature_pos" select="$feature_pos"/>
  206. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  207. </xsl:apply-templates>
  208. <!-- na koniec przetwarzania kazdego z wezlow, podmieniamy xsl biezacy wezel -->
  209. <xsl:comment>template match="RelatedFeature" mode="after_first_ant_assing_vars_childs"
  210. robi result-document href="build_{$loop_xpath}.{$uuid}.xml
  211. wiec powinnismy uruchomic ant ten plik w ciemno znajac jego nizsze wezly</xsl:comment>
  212. <xsl:variable name="featureID_name_child" select="substring-after($typeName,':')"/>
  213. <xsl:variable name="loop_xpath_child" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>
  214. <xsl:message>#142 ustalamy $loop_xpath_child=<xsl:value-of select="$loop_xpath_child"/></xsl:message>
  215. <xsl:element name="target">
  216. <xsl:attribute name="name" select="concat('get_related_feature_run_child_ant',$loop_xpath_real)"/>
  217. <xsl:attribute name="depends" select="concat('get_related_feature.',$RelatedFeaturePos,$loop_xpath_real)"/>
  218. <!--<xsl:choose>
  219. <xsl:when test=".//(RelatedFeature|RelatedFeatureRoot)">
  220. <xsl:for-each select=".//RelatedFeature[ not(child::node()/name()='RelatedFeature')]">
  221. <xsl:variable name="loop_xpath_child_ant" select="concat($loop_xpath_save,'_x2f_.',@xml_id,'.',$featureID_name)"/>
  222. <xsl:message>#148 ustalamy $loop_xpath_child_ant=<xsl:value-of select="$loop_xpath_child_ant"/></xsl:message>
  223. <!-\- <xsl:element name="target">
  224. <xsl:attribute name="name" select="$loop_xpath_child_ant"/><!-\\-'get_related_feature_run_child_ant'-\\->
  225. <xsl:attribute name="depends" select="concat('get_related_feature.',$RelatedFeaturePos)"/>-\->
  226. <!-\-<ant antfile="temp/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.xml" dir="."/>-\->
  227. <ant antfile="temp/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml" dir="."/>
  228. <!-\-</xsl:element>-\->
  229. <xsl:if test=" position()=last()">
  230. <xsl:comment>Tu task z related</xsl:comment>
  231. </xsl:if>
  232. </xsl:for-each>
  233. </xsl:when>
  234. <xsl:otherwise>
  235. <xsl:comment>#135 nie ma wiecej //RelatedFeature</xsl:comment>
  236. <!-\-<xsl:element name="target">
  237. <xsl:attribute name="name" select="'get_related_feature_run_child_ant'"/>
  238. <xsl:attribute name="depends" select="concat('get_related_feature.',$RelatedFeaturePos)"/>
  239. </xsl:element>-\->
  240. </xsl:otherwise>
  241. </xsl:choose>-->
  242. <!-- wstawienie subanta dla biezacych dzieci only -->
  243. <xsl:apply-templates mode="place_subant">
  244. <xsl:with-param name="uuid" select="$uuid"/>
  245. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  246. <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
  247. <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
  248. <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
  249. <!--<xsl:with-param name="loop_path_recurs" select="$loop_path_recurs"/>-->
  250. </xsl:apply-templates>
  251. </xsl:element>
  252. <!-- na koniec przetwarzania danego zaglebienia uruchamiamy calosc ponownie do kolejnego zaglebienia -->
  253. <!-- task do polaczenia zaglebien -->
  254. <!-- jak nie ma zaglebien to generujemy pdf i dajemy uzytkownikowi linka -->
  255. </project>
  256. </xsl:when>
  257. <xsl:when test="name()='RelatedFeatureLoop'">
  258. <xsl:message>#255 RelatedFeatureLoop - try to execute child ant in loop_path=xml_id(<xsl:value-of select="@xml_id"/>)</xsl:message>
  259. <xsl:variable name="RelatedFeatureCount" select="last()"/>
  260. <xsl:variable name="RelatedFeaturePos" select="position()"/>
  261. <xsl:variable name="featureID_name" select="substring-after($typeName,':')"/>
  262. <xsl:variable name="loop_xpath_real" select="$loop_xpath"/>
  263. <xsl:variable name="loop_xpath">
  264. <xsl:choose>
  265. <xsl:when test="$loop_xpath='root'">
  266. <xsl:value-of select="concat($loop_xpath,'_x2f_.',@xml_id,'.',$featureID_name)"/>
  267. </xsl:when>
  268. <xsl:otherwise><xsl:value-of select="$loop_xpath"/></xsl:otherwise>
  269. </xsl:choose>
  270. </xsl:variable>
  271. <xsl:variable name="typeName_dita" select="@typeName"/>
  272. <xsl:variable name="featureID_name_dita" select="substring-after($typeName_dita,':')"/>
  273. <xsl:variable name="xml_id" select="@xml_id"/>
  274. <xsl:variable name="wfs_output" select="concat($uuid,'.',$loop_xpath)"/>
  275. <xsl:variable name="wfs_output.xml" select="concat($wfs_output,'.',position(),'.',$feature_pos,'.xml')"/>
  276. <xsl:variable name="wfs_output.dita" select="concat($wfs_output,'.',position(),'.',$feature_pos,'.dita.xml')"/>
  277. <xsl:variable name="xpath_dita" select="@xpath"/>
  278. <xsl:variable name="xpath_value_dita">
  279. <xsl:choose>
  280. <xsl:when test="@xpath_value">
  281. <xsl:message>#265.1 $input_obj_with_xpath: <xsl:copy-of select="$input_obj_with_xpath"/> </xsl:message>
  282. <xsl:call-template name="xpath_filter_apply">
  283. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  284. <xsl:with-param name="xpath" select="@xpath"/>
  285. <xsl:with-param name="xpath_value" select="@xpath_value"/>
  286. </xsl:call-template>
  287. </xsl:when>
  288. <xsl:otherwise>
  289. <xsl:value-of select="$xpath_value"/><!-- parametr z template narzuca wartosc -->
  290. </xsl:otherwise>
  291. </xsl:choose>
  292. </xsl:variable>
  293. <xsl:comment>
  294. RelatedFeatureLoop:
  295. $typeName_dita= <xsl:value-of select="$typeName_dita"/>
  296. $featureID_name_dita= <xsl:value-of select="$featureID_name_dita"/>
  297. $wfs_output= <xsl:value-of select="$wfs_output"/>
  298. $wfs_output.xml= <xsl:value-of select="$wfs_output.xml"/>
  299. $wfs_output.dita= <xsl:value-of select="$wfs_output.dita"/>
  300. $xpath_dita= <xsl:value-of select="$xpath_dita"/>
  301. $xpath_value_dita= <xsl:value-of select="$xpath_value_dita"/>
  302. </xsl:comment>
  303. <project basedir="{$basedir}" name="get_related_feature{$loop_xpath_real}_{$loop_path_recurs}" default="get_related_feature_run_child_ant{$loop_xpath_real}_{$loop_path_recurs}">
  304. <xsl:comment>RelatedFeatureCount:<xsl:value-of select="count(*)"/></xsl:comment>
  305. <echo> ANT Uruchamiam $feature_pos=<xsl:value-of select="$feature_pos"/>; projekt <xsl:value-of select="$loop_xpath_real"/>; </echo>
  306. <!--<xsl:variable name="typeName" select='replace($typeName,"&quot;","")'/>--><!-- oczyszczenie z apostrofow -->
  307. <xsl:element name="property">
  308. <xsl:attribute name="name" select="'uuid'"/>
  309. <xsl:attribute name="value" select="$uuid"/>
  310. </xsl:element>
  311. <xsl:element name="property">
  312. <xsl:attribute name="name" select="'passwordBase64Basic'"/>
  313. <xsl:attribute name="value" select="$passwordBase64Basic"/>
  314. </xsl:element>
  315. <xsl:element name="property">
  316. <xsl:attribute name="name" select="'php_session_id'"/>
  317. <xsl:attribute name="value" select="$cookie_curl_option"/>
  318. </xsl:element>
  319. <xsl:element name="property">
  320. <xsl:attribute name="name" select="'php_session_id_tested'"/>
  321. <xsl:attribute name="value" select="$cookie_curl_option"/>
  322. </xsl:element>
  323. <xsl:element name="property">
  324. <xsl:attribute name="name" select="'url'"/>
  325. <xsl:attribute name="value" select="$url"/>
  326. </xsl:element>
  327. <xsl:element name="property">
  328. <xsl:attribute name="name" select="'webRootUrl'"/>
  329. <xsl:attribute name="value" select="$webRootUrl"/>
  330. </xsl:element>
  331. <xsl:element name="property"> <!--- powinien miec domyslnie sciezke narzucona-->
  332. <xsl:attribute name="name" select="'build_recurse_ant.xsl'"/>
  333. <xsl:attribute name="value" select="$build_recurse_ant.xsl"/>
  334. </xsl:element>
  335. <!--<xsl:element name="property"> <!-\-\- powinien miec domyslnie narzucona sciezke-\->
  336. <xsl:attribute name="name" select="'temp'"/>
  337. <xsl:attribute name="value" select="$temp"/>
  338. </xsl:element>-->
  339. <xsl:element name="property"><!-- - powinien miec sciezke domyslnie narzucona-->
  340. <xsl:attribute name="name" select="'builds_to_ant.xsl'"/>
  341. <xsl:attribute name="value" select="$builds_to_ant.xsl"/>
  342. </xsl:element>
  343. <property name="typeName" value="{$typeName}"/>
  344. <property name="xpath" value="{$xpath_dita}"/>
  345. <property name="xpath_value" value="{$xpath_value_dita}"/>
  346. <!-- DtypeName=p5_default_db:CRM_PROCES -Dxpath=ID -Dxpath_value=5247 -->
  347. <property name="loop_path_recurs" value="{$loop_path_recurs}"/>
  348. <xsl:comment>
  349. Important variables:
  350. typeName=<xsl:value-of select="$typeName"/>;
  351. xpath=<xsl:value-of select="$xpath"/>;
  352. xpath_value=<xsl:value-of select="$xpath_value"/>;
  353. $passwordBase64Basic=<xsl:value-of select="$passwordBase64Basic"/>
  354. </xsl:comment>
  355. <!--<xsl:apply-templates mode="ant_target" select=".">
  356. <xsl:with-param name="typeName_dita" select="$typeName_dita"/>
  357. <xsl:with-param name="featureID_name_dita" select="$featureID_name_dita"/>
  358. <xsl:with-param name="wfs_output" select="$wfs_output"/>
  359. <xsl:with-param name="wfs_output.xml" select="$wfs_output.xml"/>
  360. <xsl:with-param name="wfs_output.dita" select="$wfs_output.dita"/>
  361. <xsl:with-param name="xpath" select="$xpath"/>
  362. <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
  363. <xsl:with-param name="featureID_name" select="$featureID_name"/>
  364. <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
  365. <xsl:with-param name="RelatedFeatureCount" select="$RelatedFeatureCount"/>
  366. <xsl:with-param name="RelatedFeaturePos" select="$RelatedFeaturePos"/>
  367. <xsl:with-param name="typeName" select="$typeName"/>
  368. <xsl:with-param name="xpath_value" select="$xpath_value"/>
  369. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  370. <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
  371. <!-\-<xsl:with-param name="loop_xpath_save" select="$loop_xpath_save"/>-\->
  372. <xsl:with-param name="xml_id" select="$xml_id"/>
  373. <!-\-<xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>-\->
  374. <xsl:with-param name="feature_pos" select="$feature_pos"/>
  375. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  376. </xsl:apply-templates>-->
  377. <!-- na koniec przetwarzania kazdego z wezlow, podmieniamy xsl biezacy wezel -->
  378. <xsl:comment>template match="RelatedFeature" mode="after_first_ant_assing_vars_childs"
  379. robi result-document href="build_{$loop_xpath}.{$uuid}.xml
  380. wiec powinnismy uruchomic ant ten plik w ciemno znajac jego nizsze wezly</xsl:comment>
  381. <xsl:variable name="featureID_name_child" select="substring-after($typeName,':')"/>
  382. <xsl:variable name="loop_xpath_child" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>
  383. <xsl:message>#142 ustalamy $loop_xpath_child=<xsl:value-of select="$loop_xpath_child"/></xsl:message>
  384. <!-- warunek dla ograniczenia zapetlenia TODO do optymalizacji aby nie potrzebnie nie robilo zapytania czy jest wezel zaglebiony -->
  385. <xsl:element name="target">
  386. <xsl:attribute name="name" select="concat('get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_check')"/>
  387. <!--<tempfile property="test_child_curl_ouptut.xml"/>--> <!-- todo deleteonexit=yes -->
  388. <xsl:element name="tempfile">
  389. <xsl:attribute name="property" select="concat('get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_temp')" />
  390. <xsl:attribute name="destdir" select="$temp"/>
  391. </xsl:element>
  392. <xsl:variable name="OGC_Filter">
  393. <xsl:call-template name="simpleTypeMakeOgcFilter_merge">
  394. <xsl:with-param name="simpleTypeMakeOgcFilter" select="simpleTypeMakeOgcFilter"/>
  395. <xsl:with-param name="RelatedFilter" select="RelatedFilter"/>
  396. <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
  397. <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
  398. </xsl:call-template>
  399. </xsl:variable>
  400. <xsl:variable name="url">
  401. <xsl:value-of select="$api_url"/>/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=<xsl:value-of select="$typeName_dita"/>&amp;SRSNAME=EPSG:3003<xsl:value-of select="$OGC_Filter"/>
  402. </xsl:variable>
  403. <xsl:element name="exec">
  404. <xsl:attribute name="executable" select="'curl'"/>
  405. <xsl:attribute name="output" select="concat('${get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_temp}')"/>
  406. <xsl:element name="arg">
  407. <xsl:attribute name="line"> <xsl:value-of select="$cookie_curl_option"/> "<xsl:value-of select="$url"/>"</xsl:attribute>
  408. </xsl:element>
  409. </xsl:element>
  410. <xsl:element name="loadfile">
  411. <xsl:attribute name="property" select="concat('get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_msg')"/>
  412. <xsl:attribute name="srcFile" select="concat('${get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_temp}')" />
  413. </xsl:element>
  414. <echo> $msg ${<xsl:value-of select="concat('get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_msg')"/>} </echo>
  415. <xsl:element name="condition">
  416. <xsl:attribute name="property" select="concat('get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_test')"/>
  417. <xsl:attribute name="taskname" select="concat('get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs)"/>
  418. <xsl:element name="contains">
  419. <xsl:attribute name="string" select="concat('${get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_msg}')"/>
  420. <xsl:attribute name="substring" select="'featureMember'"/>
  421. </xsl:element>
  422. </xsl:element>
  423. </xsl:element>
  424. <!--<target name="check_if_child">
  425. <exec executable="curl"
  426. output="/Users/a.binder/Documents/biuro.biall-net.pl-gitlab-se-2015-02-16.git/SE/schema/ant-url_action/default_db.crm_proces/CRM_PROCES_tree/temp/d3e16/prezes1.root_x2f_.d3e1.CRM_PROCES_x2f_.d3e21.CRM_PROCES.1.1.xml_exists"
  427. errorproperty="wfs_error"
  428. resultproperty="wfs_result">
  429. <arg line=" -b /Users/a.binder/Documents/biuro.biall-net.pl-gitlab-se-2015-02-16.git/SE/schema/ant-url_action/default_db.crm_proces/CRM_PROCES_tree/temp/prezes1.cookie &#34;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;Filter=&lt;ogc:Filter&gt;&lt;ogc:And&gt;&lt;ogc:PropertyIsEqualTo&gt;&lt;ogc:PropertyName&gt;IID&lt;/ogc:PropertyName&gt;&lt;ogc:Literal&gt;995&lt;/ogc:Literal&gt;&lt;/ogc:PropertyIsEqualTo&gt;&lt;ogc:Or&gt;&lt;ogc:PropertyIsEqualTo&gt;&lt;ogc:PropertyName&gt;TYPE&lt;/ogc:PropertyName&gt;&lt;ogc:Literal&gt;PROCES&lt;/ogc:Literal&gt;&lt;/ogc:PropertyIsEqualTo&gt;&lt;/ogc:Or&gt;&lt;/ogc:And&gt;&lt;/ogc:Filter&gt;&#34;"/>
  430. </exec>
  431. <loadfile property="msg" srcFile="/Users/a.binder/Documents/biuro.biall-net.pl-gitlab-se-2015-02-16.git/SE/schema/ant-url_action/default_db.crm_proces/CRM_PROCES_tree/temp/d3e16/prezes1.root_x2f_.d3e1.CRM_PROCES_x2f_.d3e21.CRM_PROCES.1.1.xml_exists" />
  432. <echo> MSG to ${msg} </echo>
  433. <condition property="test" taskname="get_related_feature_run_child_antroot_x2f_.d3e1.CRM_PROCES_x2f_.d3e16.CRM_PROCES_/d3e16" >
  434. <contains string="${msg}" substring="featureMember"/>
  435. </condition>
  436. </target>-->
  437. <xsl:element name="target">
  438. <xsl:attribute name="name" select="concat('get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs)"/>
  439. <xsl:attribute name="depends" select="concat('get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_check')"/>
  440. <xsl:attribute name="if" select="concat('${get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_test}')"/>
  441. <!--<xsl:attribute name="depends" select="concat('get_related_feature.',$RelatedFeaturePos,$loop_xpath_real,'_',$loop_path_recurs)"/>-->
  442. <!--<xsl:choose>
  443. <xsl:when test=".//(RelatedFeature|RelatedFeatureRoot)">
  444. <xsl:for-each select=".//RelatedFeature[ not(child::node()/name()='RelatedFeature')]">
  445. <xsl:variable name="loop_xpath_child_ant" select="concat($loop_xpath_save,'_x2f_.',@xml_id,'.',$featureID_name)"/>
  446. <xsl:message>#148 ustalamy $loop_xpath_child_ant=<xsl:value-of select="$loop_xpath_child_ant"/></xsl:message>
  447. <!-\- <xsl:element name="target">
  448. <xsl:attribute name="name" select="$loop_xpath_child_ant"/><!-\\-'get_related_feature_run_child_ant'-\\->
  449. <xsl:attribute name="depends" select="concat('get_related_feature.',$RelatedFeaturePos)"/>-\->
  450. <!-\-<ant antfile="temp/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.xml" dir="."/>-\->
  451. <ant antfile="temp/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml" dir="."/>
  452. <!-\-</xsl:element>-\->
  453. <xsl:if test=" position()=last()">
  454. <xsl:comment>Tu task z related</xsl:comment>
  455. </xsl:if>
  456. </xsl:for-each>
  457. </xsl:when>
  458. <xsl:otherwise>
  459. <xsl:comment>#135 nie ma wiecej //RelatedFeature</xsl:comment>
  460. <!-\-<xsl:element name="target">
  461. <xsl:attribute name="name" select="'get_related_feature_run_child_ant'"/>
  462. <xsl:attribute name="depends" select="concat('get_related_feature.',$RelatedFeaturePos)"/>
  463. </xsl:element>-\->
  464. </xsl:otherwise>
  465. </xsl:choose>-->
  466. <!-- wstawienie subanta dla biezacych dzieci only -->
  467. <!--<xsl:apply-templates mode="place_subant_RelatedFeatureLoop"> - ten nie potrzebuje generowac subantow - powinien go obsluzyc glowny
  468. <xsl:with-param name="uuid" select="$uuid"/>
  469. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  470. <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
  471. <xsl:with-param name="loop_path_recurs" select="$loop_path_recurs"/>
  472. </xsl:apply-templates>-->
  473. <ant antfile="{$basedir}/build.xml" target="xml_recursed_from_tr_map"/>
  474. </xsl:element>
  475. <!-- na koniec przetwarzania danego zaglebienia uruchamiamy calosc ponownie do kolejnego zaglebienia -->
  476. <!-- task do polaczenia zaglebien -->
  477. <!-- jak nie ma zaglebien to generujemy pdf i dajemy uzytkownikowi linka -->
  478. </project>
  479. </xsl:when>
  480. <xsl:otherwise>
  481. <xsl:apply-templates mode="child_nodes"/>
  482. </xsl:otherwise>
  483. </xsl:choose>
  484. </xsl:template>
  485. <!-- trzeba przetwarzac child_nodes do pierwszego napotkania RelatedFeature -->
  486. <xsl:template mode="child_nodes" match="*">
  487. <xsl:copy-of select="."/>
  488. </xsl:template>
  489. <!--<xsl:template mode="child_nodes" match="simpleTypeMakeOgcFilter">
  490. <xsl:message>#266 bypassing temporary simpleTypeMakeOgcFilter of problem with output </xsl:message>
  491. </xsl:template>-->
  492. <xsl:template mode="place_subant" match="RelatedFeature">
  493. <xsl:param name="uuid" required="yes"/>
  494. <xsl:param name="loop_xpath" required="yes"/>
  495. <xsl:param name="loop_xpath_real" required="yes"/>
  496. <!-- wygenerujemy liste ant -->
  497. <echo> #235 ant szukam fileset id=builds_to_ant w <xsl:value-of select="concat($uuid,'.build_',$loop_xpath,'_x2f_.',@xml_id,'.',substring-after(@typeName,':'),'.*.xml')"/> </echo>
  498. <fileset id="builds_to_ant{$loop_xpath_real}{@xml_id}" dir="{$temp}" includes="{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.*.xml" />
  499. <property name="builds_to_ant{$loop_xpath_real}{@xml_id}" refid="builds_to_ant{$loop_xpath_real}{@xml_id}"/>
  500. <!--<tempfile property="builds_to_ant.xml" deleteonexit="no" destdir="temp" suffix=".xml" prefix="${uuid}.builds_to_ant-"/>-->
  501. <xsl:element name="tempfile">
  502. <xsl:attribute name="property" select="concat('builds_to_ant.xml',$loop_xpath_real,@xml_id)"/>
  503. <xsl:attribute name="deleteonexit" select="'no'"/>
  504. <xsl:attribute name="destdir" select="$temp"/>
  505. <xsl:attribute name="suffix" select="'.xml'"/>
  506. <xsl:attribute name="prefix" select="concat('${uuid}.builds_to_ant-',@xml_id,'-')"/>
  507. </xsl:element>
  508. <!--<tempfile property="builds_to_ant_file.xml" deleteonexit="no" destdir="temp" suffix=".xml" prefix="${uuid}.build_to_ant_file-"/>-->
  509. <xsl:element name="tempfile">
  510. <xsl:attribute name="property" select="concat('builds_to_ant_file.xml',$loop_xpath_real,@xml_id)"/>
  511. <xsl:attribute name="deleteonexit" select="'no'"/>
  512. <xsl:attribute name="destdir" select="$temp"/>
  513. <xsl:attribute name="suffix" select="'.xml'"/>
  514. <xsl:attribute name="prefix" select="concat('${uuid}.build_to_ant_file-',@xml_id,'-')"/>
  515. </xsl:element>
  516. <echo>#235 ant do: builds_to_ant.xml=${builds_to_ant_file.xml} mode="place_subant" match="RelatedFeature" </echo>
  517. <!--<echoxml file="'${builds_to_ant.xml}'"><builds_to_ant>${builds_to_ant}</builds_to_ant></echoxml>-->
  518. <xsl:element name="echoxml">
  519. <xsl:attribute name="file" select="concat('${builds_to_ant.xml',$loop_xpath_real,@xml_id,'}')"/>
  520. <builds_to_ant>${builds_to_ant<xsl:value-of select="concat($loop_xpath_real,@xml_id)"/>}</builds_to_ant>
  521. </xsl:element>
  522. <xsl:element name="xslt">
  523. <xsl:attribute name="basedir" select="'./'"/>
  524. <xsl:attribute name="style" select="$builds_to_ant.xsl"/>
  525. <xsl:attribute name="in" select="concat('${builds_to_ant.xml',$loop_xpath_real,@xml_id,'}')"/>
  526. <xsl:attribute name="destdir" select="'./'"/>
  527. <xsl:attribute name="out" select="concat('${builds_to_ant_file.xml',$loop_xpath_real,@xml_id,'}')"/>
  528. <factory name="net.sf.saxon.TransformerFactoryImpl">
  529. <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
  530. <!--<attribute name="http://saxon.sf.net/feature/initialMode"
  531. value="after_first_ant_assing_vars"/>-->
  532. </factory>
  533. <param name="temp" expression="{$temp}"/>
  534. <param name="loop_xpath_real" expression="{$loop_xpath_real}{@xml_id}"/>
  535. <!--<xsl:element name="param">
  536. <xsl:attribute name="name" select="'default_antfile'"/>
  537. <xsl:attribute name="expression" select="concat($temp,'/',$builds_to_ant_file.xml"/>
  538. </xsl:element>-->
  539. <param name="default_antfile" expression="{$temp}/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml"/>
  540. <classpath location="/opt/local/share/java/saxon9he.jar"/>
  541. </xsl:element>
  542. <!--<ant antfile="{$temp}/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml" dir="."/>-->
  543. <xsl:element name="ant">
  544. <xsl:attribute name="antfile" select="concat('${builds_to_ant_file.xml',$loop_xpath_real,@xml_id,'}')"/>
  545. </xsl:element>
  546. <!--<ant antfile="{$temp}/${builds_to_ant_file.xml}" dir="."/>-->
  547. </xsl:template>
  548. <xsl:template mode="place_subant" match="RelatedFeatureLoop">
  549. <xsl:param name="uuid" required="yes"/>
  550. <xsl:param name="loop_xpath" required="yes"/>
  551. <xsl:param name="loop_xpath_real" required="yes"/>
  552. <xsl:param name="xpath_dita" required="yes"/>
  553. <xsl:param name="xpath_value_dita" required="yes"/>
  554. <!--<xsl:param name="loop_path_recurs" required="yes"/>-->
  555. <!-- wygenerujemy liste ant -->
  556. <echo> #523 RelatedFeatureLoop ant bede odpalac w podkatalogu:@xml_id=(<xsl:value-of select="@xml_id"/>)
  557. <xsl:value-of select="concat($temp,'/',@xml_id,'/',$uuid,'.build_',$loop_xpath,'_x2f_.',@xml_id,'.',substring-after(@typeName,':'),'.1.xml')"/> </echo>
  558. <xsl:message>#591 todo executing by exec instead of ant without inheritAll because it's looping!!! </xsl:message>
  559. <exec command="/opt/local/bin/ant" dir="{$temp}" failifexecutionfails="true">
  560. <!--<arg line="-f ${builds_to_ant_file.xml}"/>-->
  561. <xsl:element name="arg">
  562. <xsl:attribute name="line" select="concat('-f ',@xml_id,'/',$uuid,'.build_',$loop_xpath,'_x2f_.',@xml_id,'.',substring-after(@typeName,':'),'.1.xml')"/>
  563. </xsl:element>
  564. </exec>
  565. <!--<xsl:element name="ant">
  566. <xsl:attribute name="antfile" select="concat($temp,'/',@xml_id,'/',$uuid,'.build_',$loop_xpath,'_x2f_.',@xml_id,'.',substring-after(@typeName,':'),'.1.xml')"/>
  567. <xsl:attribute name="inheritAll" select="'false'"/>
  568. <xsl:attribute name="inheritRefs" select="'false'"/>
  569. <property name="xpath" value="{$xpath_dita}"/>
  570. <property name="xpath_value_dita" value="{$xpath_value_dita}"/>
  571. </xsl:element>-->
  572. <!--<ant antfile="{$temp}/${builds_to_ant_file.xml}" dir="."/>-->
  573. </xsl:template>
  574. <xsl:template mode="place_subant" match="*">
  575. <xsl:param name="uuid" required="yes"/>
  576. <xsl:param name="loop_xpath" required="yes"/>
  577. <xsl:param name="loop_xpath_real" required="yes"/>
  578. <xsl:param name="xpath_dita" required="yes"/>
  579. <xsl:param name="xpath_value_dita" required="yes"/>
  580. <!--<xsl:param name="loop_path_recurs" required="yes"/>-->
  581. <xsl:apply-templates mode="place_subant">
  582. <xsl:with-param name="uuid" select="$uuid"/>
  583. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  584. <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
  585. <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
  586. <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
  587. <!--<xsl:with-param name="loop_path_recurs" select="$loop_path_recurs"/>-->
  588. </xsl:apply-templates>
  589. </xsl:template>
  590. <xsl:template mode="place_subant" match="text()|comment()"/>
  591. <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 -->
  592. <xsl:param name="input_obj_with_xpath" required="yes"/>
  593. <xsl:param name="xpath" required="yes"/>
  594. <xsl:param name="xpath_value" required="yes"/>
  595. <xsl:variable name="xpath_value_token">
  596. <xsl:for-each select=" tokenize($xpath_value,'/')">
  597. <xsl:message>#341 znalazlem dla=<xsl:value-of select="."/>; ; <xsl:value-of select="$input_obj_with_xpath/node()[@xpath=current()]"/></xsl:message>
  598. <xsl:if test="$input_obj_with_xpath/node()[@xpath=current()]">
  599. <xsl:copy-of select="$input_obj_with_xpath/node()[@xpath=current()]"/>
  600. </xsl:if><!-- todo to jest bledne ale dziala tymczasowo-->
  601. </xsl:for-each>
  602. </xsl:variable>
  603. <xsl:message>#345 ustalam na <xsl:value-of select="$xpath_value_token/node()[1]/text()"/>;</xsl:message>
  604. <!--<xsl:value-of select="$xpath_value_token/node()[1]/text()"/>-->
  605. <xsl:value-of select="$xpath_value_token"/>
  606. </xsl:template>
  607. <xsl:template match="RelatedFeature" mode="ant_target" >
  608. <xsl:param name="typeName_dita" required="yes"/>
  609. <xsl:param name="featureID_name_dita" required="yes"/>
  610. <xsl:param name="wfs_output" required="yes"/>
  611. <xsl:param name="wfs_output.xml" required="yes"/>
  612. <xsl:param name="wfs_output.dita" required="yes"/>
  613. <xsl:param name="xpath_dita" required="yes"/>
  614. <xsl:param name="xpath_value_dita" required="yes"/>
  615. <xsl:param name="xpath" required="yes"/>
  616. <xsl:param name="featureID_name" required="yes"/>
  617. <xsl:param name="RelatedFeatureCount" required="yes"/>
  618. <xsl:param name="RelatedFeaturePos" required="yes"/>
  619. <xsl:param name="typeName" required="yes"/>
  620. <xsl:param name="xpath_value" required="yes"/>
  621. <xsl:param name="loop_xpath" required="yes"/>
  622. <!--<xsl:param name="loop_xpath_save" required="yes"/>-->
  623. <xsl:param name="xml_id" required="yes"/>
  624. <xsl:param name="feature_pos" required="yes"/>
  625. <xsl:param name="loop_xpath_real" required="yes"/>
  626. <xsl:param name="input_obj_with_xpath" required="yes"/>
  627. <xsl:choose>
  628. <xsl:when test="$wfs_output"/>
  629. <xsl:otherwise><xsl:message terminate="yes">Not required param wfs_output - nazwa temp sciagniecia z api xml forsowana przez pierwsze sciagniecie - to set by next parraler step in ant build </xsl:message></xsl:otherwise>
  630. </xsl:choose>
  631. <!-- template do przetworzenia dity w celu wykrycia:
  632. <RelatedFeature xpath="ID_BILLING_OWNER" typeName="p5_default_db:BILLING_OWNER">
  633. <ph>Nadawca:</ph><br/>
  634. <ph xpath="name1"/><br/>
  635. <ph xpath="name2"/><br/>
  636. <ph xpath="miasto"/><br/>
  637. <ph xpath="nr_rach"/><br/>
  638. <ph xpath="BILLING_OWNER_EMAIL"/><br/>
  639. </RelatedFeature>
  640. i wyrzucenia z tego pierwszego zadania ANT do otrzymania niezbednego .xml w celu jego podstawienia pod dite
  641. w celu pozniejszego ponownego wyzwolenia tego template az do zakonczenia cyklu finalnego.
  642. Template powinien budować projekt ant do wyzwolenia z odpowiednimi parametrami dalszymi
  643. -->
  644. <!-- sprawdzamy czy template pasuje do zadania wyzwolenia czy xpath=xpath_dita oraz czy typeName=typeName_dita-->
  645. <xsl:choose>
  646. <xsl:when test="string($featureID_name)=string($featureID_name_dita)"> <!-- bylo string($xpath_dita)= string($xpath) - ale nie jest to konieczne przy recurse ! - jest to bledne zalozenie -->
  647. <!-- calculate query to api default_db/?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=p5_default_db:IN7_DZIENNIK_KORESP&SRSNAME=EPSG:3003&featureID=IN7_DZIENNIK_KORESP.1000'-->
  648. <!--<property name="OGC_Filter">%26lt;ogc:Filter%26gt;%26lt;ogc:PropertyIsNull%26gt;%26lt;ogc:PropertyName%26gt;the_geom%26lt;/ogc:PropertyName%26gt;%26lt;/ogc:PropertyIsNull%26gt;%26lt;/ogc:Filter%26gt;</property>-->
  649. <!--<xsl:variable name="OGC_Filter">&amp;Filter=&lt;ogc:Filter&gt;&lt;ogc:PropertyIsEqualTo&gt;&lt;ogc:PropertyName&gt;<xsl:value-of select="$xpath_dita"/>&lt;/ogc:PropertyName&gt;&lt;ogc:Literal&gt;<xsl:value-of select="$xpath_value_dita"/>&lt;/ogc:Literal&gt;&lt;/ogc:PropertyIsEqualTo&gt;&lt;/ogc:Filter&gt;</xsl:variable>-->
  650. <!--<xsl:variable name="OGC_Filter">
  651. <xsl:choose>
  652. <xsl:when test="RelatedFilter"><xsl:message>#406 we are enabling RelatedFilter <xsl:copy-of select="RelatedFilter" copy-namespaces="no"/></xsl:message>&amp;Filter=&lt;ogc:Filter&gt;&lt;ogc:And&gt;&lt;ogc:PropertyIsEqualTo&gt;&lt;ogc:PropertyName&gt;<xsl:value-of select="$xpath_dita"/>&lt;/ogc:PropertyName&gt;&lt;ogc:Literal&gt;<xsl:value-of select="$xpath_value_dita"/>&lt;/ogc:Literal&gt;&lt;/ogc:PropertyIsEqualTo&gt;<xsl:for-each select="RelatedFilter">&lt;ogc:PropertyIsEqualTo&gt;&lt;ogc:PropertyName&gt;<xsl:value-of select="@xpath"/>&lt;/ogc:PropertyName&gt;&lt;ogc:Literal&gt;<xsl:value-of select="@xpath_value"/>&lt;/ogc:Literal&gt;&lt;/ogc:PropertyIsEqualTo&gt;</xsl:for-each>&lt;/ogc:And&gt;&lt;/ogc:Filter&gt;</xsl:when>
  653. <xsl:otherwise>&amp;Filter=&lt;ogc:Filter&gt;&lt;ogc:PropertyIsEqualTo&gt;&lt;ogc:PropertyName&gt;<xsl:value-of select="$xpath_dita"/>&lt;/ogc:PropertyName&gt;&lt;ogc:Literal&gt;<xsl:value-of select="$xpath_value_dita"/>&lt;/ogc:Literal&gt;&lt;/ogc:PropertyIsEqualTo&gt;&lt;/ogc:Filter&gt;</xsl:otherwise>
  654. </xsl:choose>
  655. </xsl:variable>-->
  656. <xsl:variable name="OGC_Filter">
  657. <xsl:call-template name="simpleTypeMakeOgcFilter_merge">
  658. <xsl:with-param name="simpleTypeMakeOgcFilter" select="simpleTypeMakeOgcFilter"/>
  659. <xsl:with-param name="RelatedFilter" select="RelatedFilter"/>
  660. <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
  661. <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
  662. </xsl:call-template>
  663. </xsl:variable>
  664. <xsl:message>#410 final OGC_Filter is <xsl:value-of select="$OGC_Filter"/>;</xsl:message>
  665. <xsl:variable name="url">
  666. <!--<xsl:value-of select="$api_url"/>/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=<xsl:value-of select="$typeName_dita"/>&amp;SRSNAME=EPSG:3003&amp;featureID=<xsl:value-of select="$featureID_name_dita"/>.<xsl:value-of select="$xpath_value_dita"/>-->
  667. <xsl:value-of select="$api_url"/>/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=<xsl:value-of select="$typeName_dita"/>&amp;SRSNAME=EPSG:3003<xsl:value-of select="$OGC_Filter"/>
  668. </xsl:variable>
  669. <xsl:element name="target">
  670. <xsl:attribute name="name" select="concat('get_related_feature.',position(),$loop_xpath_real)"/>
  671. <xsl:choose>
  672. <xsl:when test="$RelatedFeatureCount=$RelatedFeaturePos"/>
  673. <xsl:otherwise>
  674. <xsl:attribute name="depends" select="concat('get_related_feature.',position()-1),$loop_xpath_real"/>
  675. </xsl:otherwise>
  676. </xsl:choose>
  677. <!--<tempfile property="out_task.dita" deleteonexit="no" destdir="temp"/>-->
  678. <!--<tempfile property="wfs_output" deleteonexit="no" destdir="temp" suffix=".xml" />-->
  679. <xsl:element name="exec">
  680. <xsl:attribute name="executable" select="'curl'"/>
  681. <xsl:attribute name="output" select="concat($temp,'/',$wfs_output.xml)"/>
  682. <xsl:attribute name="errorproperty" select="'wfs_error'"/>
  683. <xsl:attribute name="resultproperty" select="'wfs_result'"/>
  684. <xsl:element name="arg">
  685. <!--<xsl:attribute name="line" select='concat("-H ","&amp;Authorization: Basic ",$passwordBase64Basic," ",$url)'/>-->
  686. <!--<xsl:attribute name="line">-H 'Authorization: Basic <xsl:value-of select="$passwordBase64Basic"/>' "<xsl:value-of select="$url"/>"</xsl:attribute>-->
  687. <xsl:attribute name="line"> <xsl:value-of select="$cookie_curl_option"/> "<xsl:value-of select="$url"/>"</xsl:attribute>
  688. </xsl:element>
  689. </xsl:element>
  690. <echo message="ERROR__START"/>
  691. <xsl:element name="echo">
  692. <xsl:attribute name="message">${wfs_error}</xsl:attribute>
  693. </xsl:element>
  694. <echo message="ERROR__END"/>
  695. <xsl:choose>
  696. <xsl:when test="position()=last()">
  697. <xsl:comment>antcall target="build_recurse_ant.<xsl:value-of select="position()+1"/>.xml"</xsl:comment>
  698. </xsl:when>
  699. <xsl:otherwise>
  700. <antcall target="build_recurse_ant.{position()+1}.xml"/>
  701. </xsl:otherwise>
  702. </xsl:choose>
  703. <echo> related .dita.xml template is: $wfs_output.dita=<xsl:value-of select="$wfs_output.dita"/>; do przetwarzania na podstawie: $wfs_output.xml=<xsl:value-of select="$wfs_output.xml"/>;
  704. $temp is <xsl:value-of select="$temp"/>;</echo>
  705. <xsl:comment> teraz podmieniamy dane z otrzymanego xmla do pliku dita aby potem zrobic polaczony plik w kolejnym wyzwoleniu ant</xsl:comment>
  706. <delete file="{$temp}/{$wfs_output.dita}.vals.dita"/>
  707. <xslt basedir="./" style="{$build_recurse_ant.xsl}" in="{$temp}/{$wfs_output.dita}" destdir="./" out="{$temp}/{$wfs_output.dita}.vals.dita" >
  708. <factory name="net.sf.saxon.TransformerFactoryImpl">
  709. <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
  710. <attribute name="http://saxon.sf.net/feature/initialMode" value="after_first_ant_assing_vars"/>
  711. </factory>
  712. <classpath location="/opt/local/share/java/saxon9he.jar"/>
  713. <param name="wfs_output" expression="{$temp}/{$wfs_output.xml}"/>
  714. <param name="xpath" expression="{$xpath}" /> <!-- kontrolnie - nie potrzebne -->
  715. <param name="xpath_value" expression="{$xpath_value}" /> <!-- kontrolnie - nie potrzebne -->
  716. <param name="loop_xpath" expression="{$loop_xpath}"/>
  717. <param name="loop_xpath_save" expression="{$loop_xpath_save}"/>
  718. <param name="typeName" expression="{$typeName}"/><!-- kontrolnie - nie potrzebne -->
  719. <param name="uuid" expression="{$uuid}"/>
  720. <param name="basedir" expression="{$basedir}"/>
  721. <param name="build_recurse_ant.xsl" expression="{$build_recurse_ant.xsl}"/>
  722. <param name="passwordBase64Basic" expression="{$passwordBase64Basic}"/>
  723. <param name="feature_pos" expression="{$feature_pos}"/> <!-- aby wsadzic nr wezla do $wfs_output.dita.vals.dita -->
  724. <param name="build_recurse_ant.xsl" expression="{$build_recurse_ant.xsl}"/>
  725. <param name="temp" expression="{$temp}"/>
  726. <param name="builds_to_ant.xsl" expression="{$builds_to_ant.xsl}"/>
  727. <param name="cookie_curl_option" expression="{$cookie_curl_option}"/>
  728. <param name="api_url" expression="{$api_url}"/>
  729. <param name="loop_path_recurs" expression="{$loop_path_recurs}"/>
  730. </xslt>
  731. </xsl:element>
  732. <!-- zapisujemy wynik naszego biezacego przetwarzania dita element nizej do kolejnego przejechania z ant wyniku dla podstawienia danych -->
  733. <!-- blad - result jest po tym template -->
  734. <xsl:message>#276 $feature_pos=<xsl:value-of select="$feature_pos"/>; $xml_id=<xsl:value-of select="$xml_id"/>; writing $wfs_output.dita to <xsl:value-of select="$wfs_output.dita"/>;</xsl:message>
  735. <!-- ten plik moze byc raz bo zawiera tylko mape do przeksztalcenia danego wezla -->
  736. <xsl:result-document href="{$wfs_output.dita}">
  737. <xsl:comment>current $feature_pos=<xsl:value-of select="$feature_pos"/>; $loop_xpath=<xsl:value-of select="$loop_xpath"/>;</xsl:comment>
  738. <!--<xsl:copy-of select="."/>-->
  739. <xsl:element name="{name()}">
  740. <xsl:copy-of select="@*"/>
  741. <xsl:attribute name="feature_pos" select="$feature_pos"/>
  742. <xsl:copy-of select="./*" exclude-result-prefixes="#all" copy-namespaces="no"/>
  743. </xsl:element>
  744. </xsl:result-document>
  745. <!--<xsl:choose>
  746. <xsl:when test="$feature_pos=1"><xsl:message>#327 propably first unaviable (<xsl:value-of select="$wfs_output.dita"/>) - writing</xsl:message>
  747. <xsl:result-document href="{$wfs_output.dita}">
  748. <xsl:comment>current $loop_xpath=<xsl:value-of select="$loop_xpath"/>;</xsl:comment>
  749. <xsl:copy-of select="."/></xsl:result-document>
  750. </xsl:when>
  751. <xsl:otherwise>
  752. <xsl:message>#227.1 probably exists file:<xsl:value-of select="$wfs_output.dita"/>; - bypassing </xsl:message>
  753. </xsl:otherwise>
  754. </xsl:choose>-->
  755. </xsl:when>
  756. <xsl:otherwise>
  757. <error>
  758. <xsl:attribute name="xpath" select="$xpath"/>
  759. <xsl:attribute name="xpath_dita" select="$xpath_dita"/>
  760. <xsl:attribute name="xpath_value" select="$xpath_value"/>
  761. <xsl:attribute name="xpath_value_dita" select="$xpath_value_dita"/>
  762. <xsl:attribute name="typeName" select="$typeName"/>
  763. <xsl:attribute name="typeName_dita" select="$typeName_dita"/>
  764. <xsl:attribute name="featureID_name" select="$featureID_name"/>
  765. <xsl:attribute name="featureID_name_dita" select="$featureID_name_dita"/>
  766. <echo message="OUTPUT__START"/>
  767. <echo>
  768. Current template doesnt fit the requested data - TODO search for another template! string($xpath_dita)(<xsl:value-of select="$xpath_dita"/>) != string($xpath)(<xsl:value-of select="$xpath"/>) and string($featureID_name)(<xsl:value-of select="$featureID_name"/>) !=string($featureID_name_dita)(<xsl:value-of select="$featureID_name_dita"/>)
  769. </echo>
  770. <echo message="OUTPUT__END"/>
  771. </error>
  772. </xsl:otherwise>
  773. </xsl:choose>
  774. </xsl:template>
  775. <xsl:template name="simpleTypeMakeOgcFilter_merge"><!-- do zrobienia polaczonego filtru OGC -->
  776. <xsl:param name="simpleTypeMakeOgcFilter" required="yes"/>
  777. <xsl:param name="xpath_dita" required="yes"/>
  778. <xsl:param name="xpath_value_dita" required="yes"/>
  779. <xsl:param name="RelatedFilter"/>&amp;Filter=&lt;ogc:Filter&gt;&lt;ogc:And&gt;<xsl:choose><xsl:when test="RelatedFilter"><xsl:message>#406 we are enabling RelatedFilter <xsl:copy-of select="RelatedFilter" copy-namespaces="no"/></xsl:message>&lt;ogc:And&gt;&lt;ogc:PropertyIsEqualTo&gt;&lt;ogc:PropertyName&gt;<xsl:value-of select="$xpath_dita"/>&lt;/ogc:PropertyName&gt;&lt;ogc:Literal&gt;<xsl:value-of select="$xpath_value_dita"/>&lt;/ogc:Literal&gt;&lt;/ogc:PropertyIsEqualTo&gt;<xsl:for-each select="RelatedFilter">&lt;ogc:PropertyIsEqualTo&gt;&lt;ogc:PropertyName&gt;<xsl:value-of select="@xpath"/>&lt;/ogc:PropertyName&gt;&lt;ogc:Literal&gt;<xsl:value-of select="@xpath_value"/>&lt;/ogc:Literal&gt;&lt;/ogc:PropertyIsEqualTo&gt;</xsl:for-each>&lt;/ogc:And&gt;</xsl:when><xsl:otherwise>&lt;ogc:PropertyIsEqualTo&gt;&lt;ogc:PropertyName&gt;<xsl:value-of select="$xpath_dita"/>&lt;/ogc:PropertyName&gt;&lt;ogc:Literal&gt;<xsl:value-of select="$xpath_value_dita"/>&lt;/ogc:Literal&gt;&lt;/ogc:PropertyIsEqualTo&gt;</xsl:otherwise></xsl:choose><xsl:if test="$simpleTypeMakeOgcFilter">&lt;ogc:Or&gt;<xsl:for-each select="$simpleTypeMakeOgcFilter/ogc:Or/ogc:PropertyIsEqualTo">&lt;ogc:PropertyIsEqualTo&gt;&lt;ogc:PropertyName&gt;<xsl:value-of select="ogc:PropertyName/text()"/>&lt;/ogc:PropertyName&gt;&lt;ogc:Literal&gt;<xsl:value-of select="ogc:Literal/text()"/>&lt;/ogc:Literal&gt;&lt;/ogc:PropertyIsEqualTo&gt;</xsl:for-each>&lt;/ogc:Or&gt;</xsl:if>&lt;/ogc:And&gt;&lt;/ogc:Filter&gt;</xsl:template>
  780. <!-- second step from local ant leaf -->
  781. <xsl:template match="RelatedFeature" mode="after_first_ant_assing_vars">
  782. <xsl:param name="loop_xpath" select="$loop_xpath"/>
  783. <RelatedFeatureRoot>
  784. <xsl:message>#228 @xml_id=<xsl:value-of select="@xml_id"/>; templ match RelatedFeature mode after_first_ant_assing_vars dla @typeName=<xsl:value-of select="@typeName"/>; try to open $wfs_output=doc(<xsl:value-of select="$wfs_output"/>); </xsl:message>
  785. <!-- first assign xpath to features from -->
  786. <xsl:variable name="wfs_output_nodes" select="doc($wfs_output)"/>
  787. <xsl:variable name="current_RelatedFeature" select="*"/>
  788. <xsl:variable name="xml_id" select="@xml_id"/>
  789. <!--<input_obj_with_xpath_debug>
  790. <xsl:copy-of select="$wfs_output_nodes"/>
  791. </input_obj_with_xpath_debug>-->
  792. <xsl:message>#354 count($wfs_output_nodes//gml:featureMember) <xsl:value-of select="count($wfs_output_nodes//gml:featureMember)"/></xsl:message>
  793. <!-- tutaj jest blad przetwarzania ze wrzuca po rekordzie do kolumny - trzeba przetworzyc dla kazdego feature member -->
  794. <xsl:for-each select="$wfs_output_nodes//gml:featureMember">
  795. <xsl:variable name="input_obj_with_xpath">
  796. <xsl:apply-templates mode="after_first_ant_assing_xpath" select="node()/*"/> <!-- zeby nie wstawial do xpath nazwy feature - IN7_DZIENNIK_KORESP/ID itp -->
  797. </xsl:variable>
  798. <!--<input_obj_with_xpath_debug>
  799. <xsl:attribute name="xpath" select="$xpath"/>
  800. <!-\-<xsl:attribute name="xpath_dita" select="$xpath_dita"/>-\->
  801. <xsl:attribute name="xpath_value" select="$xpath_value"/>
  802. <!-\-<xsl:attribute name="xpath_value_dita" select="$xpath_value_dita"/>-\->
  803. <xsl:attribute name="typeName" select="$typeName"/>
  804. <!-\-<xsl:attribute name="typeName_dita" select="$typeName_dita"/>-\->
  805. <!-\-<xsl:attribute name="featureID_name" select="$featureID_name"/>-\->
  806. <!-\-<xsl:attribute name="featureID_name_dita" select="$featureID_name_dita"/>-\->
  807. <xsl:copy-of select="$input_obj_with_xpath"/>
  808. </input_obj_with_xpath_debug>-->
  809. <!--<input_node_debug>
  810. <xsl:copy-of select="."/>
  811. </input_node_debug>-->
  812. <xsl:apply-templates mode="after_first_ant_assing_vars_childs" select="$current_RelatedFeature">
  813. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  814. <xsl:with-param name="xml_id_parent" select="$xml_id"/>
  815. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  816. <xsl:with-param name="feature_pos" select="position()"/><!-- wiecej features z relacji dokladamy pozycje -->
  817. </xsl:apply-templates>
  818. </xsl:for-each>
  819. </RelatedFeatureRoot>
  820. </xsl:template>
  821. <xsl:template match="wfs:FeatureCollection|gml:featureMember" mode="after_first_ant_assing_xpath">
  822. <xsl:apply-templates mode="after_first_ant_assing_xpath"/>
  823. </xsl:template>
  824. <xsl:template mode="after_first_ant_assing_xpath" match="*">
  825. <xsl:param name="curr_xpath"/>
  826. <xsl:param name="loop_xpath" select="$loop_xpath"/>
  827. <xsl:choose>
  828. <xsl:when test="name()=$typeName">
  829. <xsl:apply-templates mode="after_first_ant_assing_xpath">
  830. <xsl:with-param name="curr_xpath" select="$curr_xpath"/>
  831. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  832. </xsl:apply-templates>
  833. </xsl:when>
  834. <xsl:otherwise>
  835. <xsl:variable name="curr_xpath_tmpl">
  836. <xsl:choose>
  837. <xsl:when test="$curr_xpath=''">
  838. <xsl:value-of select="local-name()"/> <!-- bylo local-name() - trzeba dorzucic xpath przechodzacy aby budowal sie w kwestii -->
  839. </xsl:when>
  840. <xsl:otherwise>
  841. <xsl:value-of select="concat($curr_xpath,'/',local-name())"/>
  842. </xsl:otherwise>
  843. </xsl:choose>
  844. </xsl:variable>
  845. <!--<xsl:variable name="curr_xpath_tmpl" select="'asdf'"/>-->
  846. <xsl:element name="{name()}">
  847. <xsl:attribute name="xpath" select="$curr_xpath_tmpl"/>
  848. <xsl:for-each select="@*">
  849. <xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute>
  850. </xsl:for-each>
  851. <xsl:value-of select="text()"/>
  852. <xsl:apply-templates mode="after_first_ant_assing_xpath">
  853. <xsl:with-param name="curr_xpath" select="$curr_xpath_tmpl"/>
  854. </xsl:apply-templates>
  855. </xsl:element>
  856. </xsl:otherwise>
  857. </xsl:choose>
  858. </xsl:template>
  859. <xsl:template match="text()" mode="after_first_ant_assing_xpath"/>
  860. <xsl:template match="simpleTypeMakeOgcFilter" mode="after_first_ant_assing_vars_childs">
  861. <xsl:message>#621 bypassing simpleTypeMakeOgcFilter in after_first_ant_assing_vars_childs</xsl:message>
  862. </xsl:template>
  863. <!-- przetwarzanie kolejne w celu podstawienia wartosci i wystawienia build dla kolejnych wezlow - problem z obsluga rownorzednie zagniezdzonych wezlow poprzez inne wezly -->
  864. <xsl:template match="*" mode="after_first_ant_assing_vars_childs">
  865. <xsl:param name="xml_id_parent" required="yes"/>
  866. <xsl:param name="loop_xpath" required="yes"/>
  867. <xsl:param name="input_obj_with_xpath" required="yes"/>
  868. <xsl:param name="feature_pos" required="yes"/>
  869. <xsl:for-each select=".">
  870. <xsl:choose>
  871. <!--<xsl:when test="node()='topic'">asdad</xsl:when>-->
  872. <!--<xsl:when test="name()='RelatedFeature'">
  873. <xsl:for-each select="data/apiname[@base='PROCES_INCLUDE']">
  874. <xsl:apply-templates mode="PROCES_INCLUDE">
  875. <xsl:with-param name="ID_PROCES" select="text()"/>
  876. </xsl:apply-templates>
  877. </xsl:for-each>
  878. </xsl:when>-->
  879. <!--<xsl:when test="name()='data-about'">
  880. <xsl:for-each select="data/apiname[@base='PROCES_INCLUDE']">
  881. <xsl:apply-templates mode="PROCES_INCLUDE">
  882. <xsl:with-param name="ID_PROCES" select="text()"/>
  883. </xsl:apply-templates>
  884. </xsl:for-each>
  885. </xsl:when>-->
  886. <xsl:when test="1=2"/>
  887. <xsl:otherwise>
  888. <xsl:element name="{name()}">
  889. <!--<xsl:copy-of select="namespace::node()"/>-->
  890. <xsl:for-each select="@*">
  891. <xsl:choose>
  892. <xsl:when test="name()='xpath'">
  893. <!--<xsl:attribute name="xpath_parsed" select="."/>-->
  894. <!--1:<xsl:value-of select="$parent_obj//node()[@system_cache__appinfo:xpath=$xpath]/text()"/>-->
  895. <!--<xsl:value-of select="$parent_obj//node()[local-name()=$xpath]/text()"/>-->
  896. <!--V:<xsl:value-of select="$xpath"/>-->
  897. </xsl:when>
  898. <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
  899. </xsl:choose>
  900. </xsl:for-each>
  901. <xsl:choose>
  902. <xsl:when test="@xpath">
  903. <!--<xsl:variable name="escaped_html_to_xml">
  904. <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
  905. <xsl:with-param name="html" select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]/text()"/>
  906. </xsl:call-template>
  907. </xsl:variable>-->
  908. <xsl:variable name="enter_to_ph">
  909. <xsl:apply-templates mode="enter_to_ph" select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]">
  910. <xsl:with-param name="count" select="count($input_obj_with_xpath/node()[local-name()=current()/@xpath])"/>
  911. <xsl:with-param name="element" select="name()"/>
  912. <!--<xsl:with-param name="xpath_token_filter" select="@xpath_token_filter"/>--><!-- mozliwosc wybrania pierwszego wyrazu np ' ' -->
  913. <!--<xsl:with-param name="xpath_token" select="@xpath_token"/>--><!-- mozliwosc wybrania pierwszego wyrazu np 1 -->
  914. </xsl:apply-templates>
  915. </xsl:variable>
  916. <xsl:variable name="enter_to_ph">
  917. <xsl:choose>
  918. <xsl:when test="@xpath_token_filter and @xpath_token ">
  919. <!-- implementacja filtra dla czegos oddzielonego parametrem -->
  920. <xsl:variable name="xpath_token_filter" select="tokenize($enter_to_ph,@xpath_token_filter)"/>
  921. <xsl:for-each select=" tokenize(@xpath_token,' ')">
  922. <xsl:variable name="xpath_token" select="number(.)"/>
  923. <xsl:copy-of select="$xpath_token_filter[$xpath_token]"></xsl:copy-of>
  924. </xsl:for-each>
  925. </xsl:when>
  926. <xsl:otherwise>
  927. <xsl:copy-of select="$enter_to_ph"/>
  928. </xsl:otherwise>
  929. </xsl:choose>
  930. </xsl:variable>
  931. <xsl:copy-of select="$enter_to_ph"/>
  932. </xsl:when>
  933. </xsl:choose>
  934. <xsl:value-of select="text()"/>
  935. <xsl:apply-templates mode="after_first_ant_assing_vars_childs">
  936. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  937. <xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>
  938. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  939. <xsl:with-param name="feature_pos" select="$feature_pos"/>
  940. </xsl:apply-templates>
  941. </xsl:element>
  942. </xsl:otherwise>
  943. </xsl:choose>
  944. </xsl:for-each>
  945. </xsl:template>
  946. <xsl:template match="RelatedFeature" mode="after_first_ant_assing_vars_childs">
  947. <xsl:param name="input_obj_with_xpath" required="yes"/>
  948. <xsl:param name="xml_id_parent" required="yes"/>
  949. <xsl:param name="loop_xpath" select="$loop_xpath"/>
  950. <xsl:param name="feature_pos" required="yes"/>
  951. <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>
  952. <!-- jest okazja do zrobienia bilda aby sciagnal rzeczy nizej -->
  953. <xsl:variable name="featureID_name" select="substring-after(@typeName,':')"/>
  954. <xsl:variable name="xml_id" select="@xml_id"/>
  955. <xsl:variable name="loop_xpath" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>
  956. <!--<xsl:variable name="loop_xpath_save" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>--> <!-- tutaj zapisal sie build z wezla z parent -->
  957. <!--<debug_358_RelatedFeature>
  958. <xsl:copy-of select="$input_obj_with_xpath"/>
  959. </debug_358_RelatedFeature>-->
  960. <!--<xsl:variable name="feature_pos">
  961. <xsl:choose>
  962. <xsl:when test="$feature_pos=1"/>
  963. <xsl:otherwise><xsl:value-of select="$feature_pos"/></xsl:otherwise>
  964. </xsl:choose>
  965. </xsl:variable>-->
  966. <xsl:message>#389 jest okazja do zrobienia bilda $feature_pos=<xsl:value-of select="$feature_pos"/> $xml_id_parent=<xsl:value-of select="$xml_id_parent"/>; $xml_id=<xsl:value-of select="$xml_id"/>; result-document=<xsl:value-of select="concat($uuid,'.build_',$loop_xpath,'.xml')"/> match=RelatedFeature mode=after_first_ant_assing_vars_childs </xsl:message>
  967. <xsl:result-document href="{$temp}/{$uuid}.build_{$loop_xpath}.{$feature_pos}.xml">
  968. <xsl:apply-templates select=".">
  969. <xsl:with-param name="typeName" select="@typeName"/>
  970. <xsl:with-param name="xpath" select="@xpath"/>
  971. <xsl:with-param name="xpath_value" select="@xpath_value"/>
  972. <!--<xsl:with-param name="loop_xpath_save" select="$loop_xpath"/>-->
  973. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  974. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  975. <xsl:with-param name="wfs_output" select="concat($uuid,'.',$loop_xpath)" />
  976. <xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>
  977. <xsl:with-param name="feature_pos" select="$feature_pos"/>
  978. <xsl:with-param name="loop_path_recurs" select="$loop_path_recurs"/>
  979. <!--<xsl:with-param name="wfs_output.xml" />-->
  980. </xsl:apply-templates>
  981. </xsl:result-document>
  982. <xsl:element name="RelatedFeature">
  983. <xsl:copy-of select="@*"/>
  984. <xsl:attribute name="featureID_name" select="$featureID_name"/>
  985. <xsl:attribute name="loop_xpath" select="$loop_xpath"/>
  986. </xsl:element>
  987. </xsl:template>
  988. <xsl:template match="RelatedFeatureLoop" mode="after_first_ant_assing_vars_childs">
  989. <xsl:param name="input_obj_with_xpath" required="yes"/>
  990. <xsl:param name="xml_id_parent" required="yes"/>
  991. <xsl:param name="loop_xpath" select="$loop_xpath"/>
  992. <xsl:param name="feature_pos" required="yes"/>
  993. <xsl:message>#411-817 $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>
  994. <!-- jest okazja do zrobienia bilda aby sciagnal rzeczy nizej -->
  995. <xsl:variable name="featureID_name" select="substring-after(@typeName,':')"/>
  996. <xsl:variable name="xml_id" select="@xml_id"/>
  997. <xsl:variable name="loop_xpath" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>
  998. <!--<xsl:variable name="loop_xpath_save" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>--> <!-- tutaj zapisal sie build z wezla z parent -->
  999. <!--<debug_358_RelatedFeature>
  1000. <xsl:copy-of select="$input_obj_with_xpath"/>
  1001. </debug_358_RelatedFeature>-->
  1002. <!--<xsl:variable name="feature_pos">
  1003. <xsl:choose>
  1004. <xsl:when test="$feature_pos=1"/>
  1005. <xsl:otherwise><xsl:value-of select="$feature_pos"/></xsl:otherwise>
  1006. </xsl:choose>
  1007. </xsl:variable>-->
  1008. <xsl:message>#832 RelatedFeatureLoop jest okazja do zrobienia bilda $feature_pos=<xsl:value-of select="$feature_pos"/> $xml_id_parent=<xsl:value-of select="$xml_id_parent"/>; $xml_id=<xsl:value-of select="$xml_id"/>; result-document=<xsl:value-of select="concat($uuid,'.build_',$loop_xpath,'.xml')"/> match=RelatedFeature mode=after_first_ant_assing_vars_childs </xsl:message>
  1009. <xsl:variable name="loop_path_recurs">
  1010. <xsl:choose>
  1011. <xsl:when test=" string-length($loop_path_recurs) &lt;1">
  1012. <xsl:value-of select="concat('/',@xml_id)"/>
  1013. </xsl:when>
  1014. <xsl:otherwise><xsl:value-of select="concat($loop_path_recurs,'/',@xml_id)"/></xsl:otherwise>
  1015. </xsl:choose>
  1016. </xsl:variable>
  1017. <xsl:result-document href="{$temp}/{@xml_id}/{$uuid}.build_{$loop_xpath}.{$feature_pos}.xml" >
  1018. <xsl:apply-templates select=".">
  1019. <xsl:with-param name="typeName" select="@typeName"/>
  1020. <xsl:with-param name="xpath" select="@xpath"/>
  1021. <xsl:with-param name="xpath_value" select="@xpath_value"/>
  1022. <!--<xsl:with-param name="loop_xpath_save" select="$loop_xpath"/>-->
  1023. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  1024. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  1025. <xsl:with-param name="wfs_output" select="concat($uuid,'.',$loop_xpath)" />
  1026. <xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>
  1027. <xsl:with-param name="feature_pos" select="$feature_pos"/>
  1028. <xsl:with-param name="loop_path_recurs" select="$loop_path_recurs"/>
  1029. <!--<xsl:with-param name="wfs_output.xml" />-->
  1030. </xsl:apply-templates>
  1031. </xsl:result-document>
  1032. <xsl:element name="RelatedFeature">
  1033. <xsl:copy-of select="@*"/>
  1034. <xsl:attribute name="featureID_name" select="$featureID_name"/>
  1035. <xsl:attribute name="loop_xpath" select="$loop_xpath"/>
  1036. </xsl:element>
  1037. </xsl:template>
  1038. <xsl:template match="text()" mode="after_first_ant_assing_vars_childs"/>
  1039. <xsl:template match="comment()" mode="after_first_ant_assing_vars_childs"/>
  1040. <!-- pozbieranie do kupy wszystkich xmli i zlozenie dity -->
  1041. <xsl:template match="*" mode="enter_to_ph">
  1042. <xsl:param name="count"/>
  1043. <xsl:param name="element"/>
  1044. <xsl:variable name="current" select="."/>
  1045. <xsl:variable name="surround_with">
  1046. <xsl:choose>
  1047. <xsl:when test="$element='p'"><xsl:value-of select="'codeblock'"/></xsl:when>
  1048. <xsl:when test="$element='bodydiv'"><xsl:value-of select="'p'"/></xsl:when>
  1049. <xsl:otherwise><xsl:value-of select="'codeblock'"/></xsl:otherwise>
  1050. </xsl:choose>
  1051. </xsl:variable>
  1052. <xsl:choose>
  1053. <xsl:when test=" contains( text(),'&#13;')">
  1054. <xsl:for-each select="tokenize( text(),'&#13;')">
  1055. <xsl:element name="{$surround_with}"><!-- to jest przetwarzane jak jest tekst lamany -->
  1056. <xsl:value-of select="."/>
  1057. </xsl:element>
  1058. </xsl:for-each>
  1059. </xsl:when>
  1060. <xsl:otherwise>
  1061. <xsl:choose>
  1062. <xsl:when test="$count &gt;1">
  1063. <codeblock>
  1064. <!--<xsl:attribute name="DDxpath" select="@xpath"/>-->
  1065. <!--DN(<xsl:value-of select="$element"/>)-->
  1066. <!--count:<xsl:value-of select="$count"/>-->
  1067. <xsl:copy-of select=" text()"/>
  1068. </codeblock>
  1069. </xsl:when>
  1070. <xsl:otherwise>
  1071. <xsl:apply-templates mode="enter_to_ph_text">
  1072. <xsl:with-param name="element" select="$element"/>
  1073. </xsl:apply-templates>
  1074. <!--<xsl:copy-of select=" text()"/>-->
  1075. </xsl:otherwise>
  1076. </xsl:choose>
  1077. </xsl:otherwise>
  1078. </xsl:choose>
  1079. </xsl:template>
  1080. <!-- dodanie enterow dla tabel w ktorych wyrazy sa dluzsze niz 10 znakow -->
  1081. <xsl:template match="text()" mode="enter_to_ph_text">
  1082. <xsl:param name="element" required="yes"/>
  1083. <xsl:choose>
  1084. <xsl:when test="$element='entry'">
  1085. <xsl:for-each select="tokenize(.,' ')">
  1086. <xsl:value-of select="' '"/>
  1087. <xsl:variable name="phrase" select="."/>
  1088. <xsl:for-each select="1 to string-length(.)">
  1089. <xsl:if test="position() mod 12 = 0"><xsl:value-of select="' -'"/></xsl:if>
  1090. <xsl:value-of select="substring($phrase,position(),1)"/>
  1091. </xsl:for-each>
  1092. </xsl:for-each>
  1093. </xsl:when>
  1094. <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
  1095. </xsl:choose>
  1096. </xsl:template>
  1097. </xsl:stylesheet>