build_recurse_ant.xsl 91 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238
  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="typeNameRealResource">
  93. <!-- override in case of different real resource by filtered resource -->
  94. <xsl:choose>
  95. <xsl:when test="@typeNameRealResource"><xsl:value-of select="@typeNameRealResource"/></xsl:when>
  96. <xsl:otherwise><xsl:value-of select="$typeName_dita"/></xsl:otherwise>
  97. </xsl:choose>
  98. </xsl:variable>
  99. <xsl:variable name="featureID_name_dita" select="substring-after($typeName_dita,':')"/>
  100. <xsl:variable name="xml_id" select="@xml_id"/>
  101. <!--<xsl:variable name="wfs_output" select="concat($uuid,'.',$loop_xpath,'_x2f_',$featureID_name)"/>-->
  102. <xsl:variable name="wfs_output" select="concat($uuid,'.',$loop_xpath)"/>
  103. <!--<xsl:variable name="wfs_output.xml" select="concat($wfs_output,'.',position(),'.xml')"/>-->
  104. <xsl:variable name="wfs_output.xml" select="concat($wfs_output,'.',position(),'.',$feature_pos,'.xml')"/>
  105. <xsl:variable name="wfs_output.dita" select="concat($wfs_output,'.',position(),'.',$feature_pos,'.dita.xml')"/>
  106. <!--<xsl:variable name="wfs_output.dita" select="concat($wfs_output,'.',position(),'.','.dita.xml')"/>-->
  107. <!-- dane z oczekiwanego template .dita -->
  108. <xsl:variable name="xpath_dita">
  109. <xsl:choose>
  110. <xsl:when test=" string-length($xpath) &gt;0">
  111. <xsl:value-of select="$xpath"/>
  112. <xsl:message>#121 narzucam $xpath=(<xsl:value-of select="$xpath"/>) z wyzwolenia build.xml </xsl:message>
  113. </xsl:when>
  114. <xsl:otherwise><xsl:value-of select="@xpath"/></xsl:otherwise>
  115. </xsl:choose>
  116. </xsl:variable>
  117. <xsl:variable name="xpath_value_dita">
  118. <xsl:choose>
  119. <xsl:when test="@xpath_value">
  120. <!--<xsl:variable name="xpath_value_tokens" select="tokenize(@xpath_value,'/')"/>-->
  121. <!--<xsl:value-of select="'todo zapytanie xpath do przetworzenia'"/>-->
  122. <!--<xsl:copy-of select="$xpath_value_tokens"></xsl:copy-of>-->
  123. <!--<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>-->
  124. <xsl:message>#67.1 $input_obj_with_xpath: <xsl:copy-of select="$input_obj_with_xpath"/> </xsl:message>
  125. <!--<xsl:variable name="xpath_value_token">-->
  126. <xsl:call-template name="xpath_filter_apply">
  127. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  128. <xsl:with-param name="xpath" select="@xpath"/>
  129. <xsl:with-param name="xpath_value" select="@xpath_value"/>
  130. </xsl:call-template>
  131. <!--</xsl:variable>-->
  132. <!--<xsl:message>#73 ustalam na <xsl:value-of select="$xpath_value_token/node()[1]/text()"/>;</xsl:message>-->
  133. <!--<xsl:value-of select="$xpath_value_token/node()[1]/text()"/>-->
  134. <!--<xsl:value-of select="$xpath_value_token"/>-->
  135. </xsl:when>
  136. <xsl:when test="string-length($xpath_value) &gt;0">
  137. <xsl:message>#67.0 $xpath_value=(<xsl:value-of select="$xpath_value"/>); narzucone pewnie z wyzwolenia build.xml</xsl:message>
  138. <xsl:value-of select="$xpath_value"/>
  139. </xsl:when>
  140. <xsl:otherwise>
  141. <xsl:value-of select="$xpath_value"/><!-- parametr z template narzuca wartosc -->
  142. </xsl:otherwise>
  143. </xsl:choose>
  144. </xsl:variable>
  145. <xsl:message>#71 wstawiam projekt $feature_pos=<xsl:value-of select="$feature_pos"/>; $loop_xpath=<xsl:value-of select="$loop_xpath"/>; </xsl:message>
  146. <project basedir="../." name="get_related_feature{$loop_xpath_real}" default="get_related_feature_run_child_ant{$loop_xpath_real}">
  147. <xsl:comment>RelatedFeatureCount:<xsl:value-of select="count(*)"/></xsl:comment>
  148. <echo> ANT Uruchamiam $feature_pos=<xsl:value-of select="$feature_pos"/>; projekt <xsl:value-of select="$loop_xpath_real"/>; </echo>
  149. <!--<xsl:variable name="typeName" select='replace($typeName,"&quot;","")'/>--><!-- oczyszczenie z apostrofow -->
  150. <xsl:element name="property">
  151. <xsl:attribute name="name" select="'uuid'"/>
  152. <xsl:attribute name="value" select="$uuid"/>
  153. </xsl:element>
  154. <xsl:element name="property">
  155. <xsl:attribute name="name" select="'passwordBase64Basic'"/>
  156. <xsl:attribute name="value" select="$passwordBase64Basic"/>
  157. </xsl:element>
  158. <xsl:element name="property">
  159. <xsl:attribute name="name" select="'php_session_id'"/>
  160. <xsl:attribute name="value" select="$cookie_curl_option"/>
  161. </xsl:element>
  162. <xsl:element name="property">
  163. <xsl:attribute name="name" select="'url'"/>
  164. <xsl:attribute name="value" select="$url"/>
  165. </xsl:element>
  166. <xsl:element name="property">
  167. <xsl:attribute name="name" select="'webRootUrl'"/>
  168. <xsl:attribute name="value" select="$webRootUrl"/>
  169. </xsl:element>
  170. <xsl:element name="property">
  171. <xsl:attribute name="name" select="'build_recurse_ant.xsl'"/>
  172. <xsl:attribute name="value" select="$build_recurse_ant.xsl"/>
  173. </xsl:element>
  174. <xsl:element name="property">
  175. <xsl:attribute name="name" select="'temp'"/>
  176. <xsl:attribute name="value" select="$temp"/>
  177. </xsl:element>
  178. <xsl:element name="property">
  179. <xsl:attribute name="name" select="'builds_to_ant.xsl'"/>
  180. <xsl:attribute name="value" select="$builds_to_ant.xsl"/>
  181. </xsl:element>
  182. <xsl:element name="property">
  183. <xsl:attribute name="name" select="'loop_path_recurs'"/>
  184. <xsl:attribute name="value" select="$loop_path_recurs"/>
  185. </xsl:element>
  186. <xsl:comment>
  187. Important variables:
  188. typeName=<xsl:value-of select="$typeName"/>;
  189. xpath=<xsl:value-of select="$xpath"/>;
  190. xpath_value=<xsl:value-of select="$xpath_value"/>;
  191. $passwordBase64Basic=<xsl:value-of select="$passwordBase64Basic"/>
  192. </xsl:comment>
  193. <xsl:apply-templates mode="ant_target" select=".">
  194. <xsl:with-param name="typeName_dita" select="$typeName_dita"/>
  195. <xsl:with-param name="featureID_name_dita" select="$featureID_name_dita"/>
  196. <xsl:with-param name="wfs_output" select="$wfs_output"/>
  197. <xsl:with-param name="wfs_output.xml" select="$wfs_output.xml"/>
  198. <xsl:with-param name="wfs_output.dita" select="$wfs_output.dita"/>
  199. <xsl:with-param name="xpath" select="$xpath"/>
  200. <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
  201. <xsl:with-param name="featureID_name" select="$featureID_name"/>
  202. <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
  203. <xsl:with-param name="RelatedFeatureCount" select="$RelatedFeatureCount"/>
  204. <xsl:with-param name="RelatedFeaturePos" select="$RelatedFeaturePos"/>
  205. <xsl:with-param name="typeName" select="$typeName"/>
  206. <xsl:with-param name="xpath_value" select="$xpath_value"/>
  207. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  208. <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
  209. <!--<xsl:with-param name="loop_xpath_save" select="$loop_xpath_save"/>-->
  210. <xsl:with-param name="xml_id" select="$xml_id"/>
  211. <!--<xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>-->
  212. <xsl:with-param name="feature_pos" select="$feature_pos"/>
  213. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  214. <xsl:with-param name="typeNameRealResource" select="$typeNameRealResource"/>
  215. </xsl:apply-templates>
  216. <!-- na koniec przetwarzania kazdego z wezlow, podmieniamy xsl biezacy wezel -->
  217. <xsl:comment>template match="RelatedFeature" mode="after_first_ant_assing_vars_childs"
  218. robi result-document href="build_{$loop_xpath}.{$uuid}.xml
  219. wiec powinnismy uruchomic ant ten plik w ciemno znajac jego nizsze wezly</xsl:comment>
  220. <xsl:variable name="featureID_name_child" select="substring-after($typeName,':')"/>
  221. <xsl:variable name="loop_xpath_child" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>
  222. <xsl:message>#142 ustalamy $loop_xpath_child=<xsl:value-of select="$loop_xpath_child"/></xsl:message>
  223. <xsl:element name="target">
  224. <xsl:attribute name="name" select="concat('get_related_feature_run_child_ant',$loop_xpath_real)"/>
  225. <xsl:attribute name="depends" select="concat('get_related_feature.',$RelatedFeaturePos,$loop_xpath_real)"/>
  226. <!--<xsl:choose>
  227. <xsl:when test=".//(RelatedFeature|RelatedFeatureRoot)">
  228. <xsl:for-each select=".//RelatedFeature[ not(child::node()/name()='RelatedFeature')]">
  229. <xsl:variable name="loop_xpath_child_ant" select="concat($loop_xpath_save,'_x2f_.',@xml_id,'.',$featureID_name)"/>
  230. <xsl:message>#148 ustalamy $loop_xpath_child_ant=<xsl:value-of select="$loop_xpath_child_ant"/></xsl:message>
  231. <!-\- <xsl:element name="target">
  232. <xsl:attribute name="name" select="$loop_xpath_child_ant"/><!-\\-'get_related_feature_run_child_ant'-\\->
  233. <xsl:attribute name="depends" select="concat('get_related_feature.',$RelatedFeaturePos)"/>-\->
  234. <!-\-<ant antfile="temp/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.xml" dir="."/>-\->
  235. <ant antfile="temp/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml" dir="."/>
  236. <!-\-</xsl:element>-\->
  237. <xsl:if test=" position()=last()">
  238. <xsl:comment>Tu task z related</xsl:comment>
  239. </xsl:if>
  240. </xsl:for-each>
  241. </xsl:when>
  242. <xsl:otherwise>
  243. <xsl:comment>#135 nie ma wiecej //RelatedFeature</xsl:comment>
  244. <!-\-<xsl:element name="target">
  245. <xsl:attribute name="name" select="'get_related_feature_run_child_ant'"/>
  246. <xsl:attribute name="depends" select="concat('get_related_feature.',$RelatedFeaturePos)"/>
  247. </xsl:element>-\->
  248. </xsl:otherwise>
  249. </xsl:choose>-->
  250. <!-- wstawienie subanta dla biezacych dzieci only -->
  251. <xsl:apply-templates mode="place_subant">
  252. <xsl:with-param name="uuid" select="$uuid"/>
  253. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  254. <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
  255. <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
  256. <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
  257. <!--<xsl:with-param name="loop_path_recurs" select="$loop_path_recurs"/>-->
  258. </xsl:apply-templates>
  259. </xsl:element>
  260. <!-- na koniec przetwarzania danego zaglebienia uruchamiamy calosc ponownie do kolejnego zaglebienia -->
  261. <!-- task do polaczenia zaglebien -->
  262. <!-- jak nie ma zaglebien to generujemy pdf i dajemy uzytkownikowi linka -->
  263. </project>
  264. </xsl:when>
  265. <xsl:when test="name()='RelatedFeatureLoop'">
  266. <xsl:message>#255 RelatedFeatureLoop - try to execute child ant in loop_path=xml_id(<xsl:value-of select="@xml_id"/>)</xsl:message>
  267. <xsl:variable name="RelatedFeatureCount" select="last()"/>
  268. <xsl:variable name="RelatedFeaturePos" select="position()"/>
  269. <xsl:variable name="featureID_name" select="substring-after($typeName,':')"/>
  270. <xsl:variable name="loop_xpath_real" select="$loop_xpath"/>
  271. <xsl:variable name="loop_xpath">
  272. <xsl:choose>
  273. <xsl:when test="$loop_xpath='root'">
  274. <xsl:value-of select="concat($loop_xpath,'_x2f_.',@xml_id,'.',$featureID_name)"/>
  275. </xsl:when>
  276. <xsl:otherwise><xsl:value-of select="$loop_xpath"/></xsl:otherwise>
  277. </xsl:choose>
  278. </xsl:variable>
  279. <xsl:variable name="typeName_dita" select="@typeName"/>
  280. <xsl:variable name="typeNameRealResource">
  281. <!-- override in case of different real resource by filtered resource -->
  282. <xsl:choose>
  283. <xsl:when test="@typeNameRealResource"><xsl:value-of select="@typeNameRealResource"/></xsl:when>
  284. <xsl:otherwise><xsl:value-of select="@typeName"/></xsl:otherwise>
  285. </xsl:choose>
  286. </xsl:variable>
  287. <xsl:variable name="featureID_name_dita" select="substring-after($typeName_dita,':')"/>
  288. <xsl:variable name="xml_id" select="@xml_id"/>
  289. <xsl:variable name="wfs_output" select="concat($uuid,'.',$loop_xpath)"/>
  290. <xsl:variable name="wfs_output.xml" select="concat($wfs_output,'.',position(),'.',$feature_pos,'.xml')"/>
  291. <xsl:variable name="wfs_output.dita" select="concat($wfs_output,'.',position(),'.',$feature_pos,'.dita.xml')"/>
  292. <xsl:variable name="xpath_dita" select="@xpath"/>
  293. <xsl:variable name="xpath_value_dita">
  294. <xsl:choose>
  295. <xsl:when test="@xpath_value">
  296. <xsl:message>#265.1 $input_obj_with_xpath: <xsl:copy-of select="$input_obj_with_xpath"/> </xsl:message>
  297. <xsl:call-template name="xpath_filter_apply">
  298. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  299. <xsl:with-param name="xpath" select="@xpath"/>
  300. <xsl:with-param name="xpath_value" select="@xpath_value"/>
  301. </xsl:call-template>
  302. </xsl:when>
  303. <xsl:otherwise>
  304. <xsl:value-of select="$xpath_value"/><!-- parametr z template narzuca wartosc -->
  305. </xsl:otherwise>
  306. </xsl:choose>
  307. </xsl:variable>
  308. <xsl:comment>
  309. RelatedFeatureLoop:
  310. $typeName_dita= <xsl:value-of select="$typeName_dita"/>
  311. $featureID_name_dita= <xsl:value-of select="$featureID_name_dita"/>
  312. $wfs_output= <xsl:value-of select="$wfs_output"/>
  313. $wfs_output.xml= <xsl:value-of select="$wfs_output.xml"/>
  314. $wfs_output.dita= <xsl:value-of select="$wfs_output.dita"/>
  315. $xpath_dita= <xsl:value-of select="$xpath_dita"/>
  316. $xpath_value_dita= <xsl:value-of select="$xpath_value_dita"/>
  317. </xsl:comment>
  318. <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}">
  319. <xsl:comment>RelatedFeatureCount:<xsl:value-of select="count(*)"/></xsl:comment>
  320. <echo> ANT Uruchamiam $feature_pos=<xsl:value-of select="$feature_pos"/>; projekt <xsl:value-of select="$loop_xpath_real"/>; </echo>
  321. <!--<xsl:variable name="typeName" select='replace($typeName,"&quot;","")'/>--><!-- oczyszczenie z apostrofow -->
  322. <xsl:element name="property">
  323. <xsl:attribute name="name" select="'uuid'"/>
  324. <xsl:attribute name="value" select="$uuid"/>
  325. </xsl:element>
  326. <xsl:element name="property">
  327. <xsl:attribute name="name" select="'passwordBase64Basic'"/>
  328. <xsl:attribute name="value" select="$passwordBase64Basic"/>
  329. </xsl:element>
  330. <xsl:element name="property">
  331. <xsl:attribute name="name" select="'php_session_id'"/>
  332. <xsl:attribute name="value" select="$cookie_curl_option"/>
  333. </xsl:element>
  334. <xsl:element name="property">
  335. <xsl:attribute name="name" select="'php_session_id_tested'"/>
  336. <xsl:attribute name="value" select="$cookie_curl_option"/>
  337. </xsl:element>
  338. <xsl:element name="property">
  339. <xsl:attribute name="name" select="'url'"/>
  340. <xsl:attribute name="value" select="$url"/>
  341. </xsl:element>
  342. <xsl:element name="property">
  343. <xsl:attribute name="name" select="'webRootUrl'"/>
  344. <xsl:attribute name="value" select="$webRootUrl"/>
  345. </xsl:element>
  346. <xsl:element name="property"> <!--- powinien miec domyslnie sciezke narzucona-->
  347. <xsl:attribute name="name" select="'build_recurse_ant.xsl'"/>
  348. <xsl:attribute name="value" select="$build_recurse_ant.xsl"/>
  349. </xsl:element>
  350. <!--<xsl:element name="property"> <!-\-\- powinien miec domyslnie narzucona sciezke-\->
  351. <xsl:attribute name="name" select="'temp'"/>
  352. <xsl:attribute name="value" select="$temp"/>
  353. </xsl:element>-->
  354. <xsl:element name="property"><!-- - powinien miec sciezke domyslnie narzucona-->
  355. <xsl:attribute name="name" select="'builds_to_ant.xsl'"/>
  356. <xsl:attribute name="value" select="$builds_to_ant.xsl"/>
  357. </xsl:element>
  358. <property name="typeName" value="{$typeName}"/>
  359. <property name="xpath" value="{$xpath_dita}"/>
  360. <property name="xpath_value" value="{$xpath_value_dita}"/>
  361. <!-- DtypeName=p5_default_db:CRM_PROCES -Dxpath=ID -Dxpath_value=5247 -->
  362. <property name="loop_path_recurs" value="{$loop_path_recurs}"/>
  363. <xsl:comment>
  364. Important variables:
  365. typeName=<xsl:value-of select="$typeName"/>;
  366. xpath=<xsl:value-of select="$xpath"/>;
  367. xpath_value=<xsl:value-of select="$xpath_value"/>;
  368. $passwordBase64Basic=<xsl:value-of select="$passwordBase64Basic"/>
  369. </xsl:comment>
  370. <!--<xsl:apply-templates mode="ant_target" select=".">
  371. <xsl:with-param name="typeName_dita" select="$typeName_dita"/>
  372. <xsl:with-param name="featureID_name_dita" select="$featureID_name_dita"/>
  373. <xsl:with-param name="wfs_output" select="$wfs_output"/>
  374. <xsl:with-param name="wfs_output.xml" select="$wfs_output.xml"/>
  375. <xsl:with-param name="wfs_output.dita" select="$wfs_output.dita"/>
  376. <xsl:with-param name="xpath" select="$xpath"/>
  377. <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
  378. <xsl:with-param name="featureID_name" select="$featureID_name"/>
  379. <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
  380. <xsl:with-param name="RelatedFeatureCount" select="$RelatedFeatureCount"/>
  381. <xsl:with-param name="RelatedFeaturePos" select="$RelatedFeaturePos"/>
  382. <xsl:with-param name="typeName" select="$typeName"/>
  383. <xsl:with-param name="xpath_value" select="$xpath_value"/>
  384. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  385. <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
  386. <!-\-<xsl:with-param name="loop_xpath_save" select="$loop_xpath_save"/>-\->
  387. <xsl:with-param name="xml_id" select="$xml_id"/>
  388. <!-\-<xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>-\->
  389. <xsl:with-param name="feature_pos" select="$feature_pos"/>
  390. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  391. </xsl:apply-templates>-->
  392. <!-- na koniec przetwarzania kazdego z wezlow, podmieniamy xsl biezacy wezel -->
  393. <xsl:comment>template match="RelatedFeature" mode="after_first_ant_assing_vars_childs"
  394. robi result-document href="build_{$loop_xpath}.{$uuid}.xml
  395. wiec powinnismy uruchomic ant ten plik w ciemno znajac jego nizsze wezly</xsl:comment>
  396. <xsl:variable name="featureID_name_child" select="substring-after($typeName,':')"/>
  397. <xsl:variable name="loop_xpath_child" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>
  398. <xsl:message>#142 ustalamy $loop_xpath_child=<xsl:value-of select="$loop_xpath_child"/></xsl:message>
  399. <!-- warunek dla ograniczenia zapetlenia TODO do optymalizacji aby nie potrzebnie nie robilo zapytania czy jest wezel zaglebiony -->
  400. <xsl:element name="target">
  401. <xsl:attribute name="name" select="concat('get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_check')"/>
  402. <!--<tempfile property="test_child_curl_ouptut.xml"/>--> <!-- todo deleteonexit=yes -->
  403. <xsl:element name="tempfile">
  404. <xsl:attribute name="property" select="concat('get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_temp')" />
  405. <xsl:attribute name="destdir" select="$temp"/>
  406. <xsl:attribute name="prefix" select="'test_if_exec_child_ant-'"/>
  407. <xsl:attribute name="suffix" select="'.xml'"/>
  408. </xsl:element>
  409. <xsl:variable name="OGC_Filter">
  410. <xsl:call-template name="simpleTypeMakeOgcFilter_merge">
  411. <xsl:with-param name="simpleTypeMakeOgcFilter" select="simpleTypeMakeOgcFilter"/>
  412. <xsl:with-param name="RelatedFilter" select="RelatedFilter"/>
  413. <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
  414. <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
  415. </xsl:call-template>
  416. </xsl:variable>
  417. <xsl:variable name="url">
  418. <xsl:value-of select="$api_url"/>/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=<xsl:value-of select="$typeNameRealResource"/>&amp;SRSNAME=EPSG:3003<xsl:value-of select="$OGC_Filter"/>
  419. </xsl:variable>
  420. <xsl:element name="exec">
  421. <xsl:attribute name="executable" select="'curl'"/>
  422. <xsl:attribute name="output" select="concat('${get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_temp}')"/>
  423. <xsl:element name="arg">
  424. <xsl:attribute name="line"> <xsl:value-of select="$cookie_curl_option"/> "<xsl:value-of select="$url"/>"</xsl:attribute>
  425. </xsl:element>
  426. </xsl:element>
  427. <xsl:element name="loadfile">
  428. <xsl:attribute name="property" select="concat('get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_msg')"/>
  429. <xsl:attribute name="srcFile" select="concat('${get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_temp}')" />
  430. </xsl:element>
  431. <echo> $msg ${<xsl:value-of select="concat('get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_msg')"/>} </echo>
  432. <xsl:element name="condition">
  433. <xsl:attribute name="property" select="concat('get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_test')"/>
  434. <xsl:attribute name="taskname" select="concat('get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs)"/>
  435. <xsl:element name="contains">
  436. <xsl:attribute name="string" select="concat('${get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_msg}')"/>
  437. <xsl:attribute name="substring" select="'featureMember'"/>
  438. </xsl:element>
  439. </xsl:element>
  440. </xsl:element>
  441. <!--<target name="check_if_child">
  442. <exec executable="curl"
  443. 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"
  444. errorproperty="wfs_error"
  445. resultproperty="wfs_result">
  446. <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;"/>
  447. </exec>
  448. <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" />
  449. <echo> MSG to ${msg} </echo>
  450. <condition property="test" taskname="get_related_feature_run_child_antroot_x2f_.d3e1.CRM_PROCES_x2f_.d3e16.CRM_PROCES_/d3e16" >
  451. <contains string="${msg}" substring="featureMember"/>
  452. </condition>
  453. </target>-->
  454. <xsl:element name="target">
  455. <xsl:attribute name="name" select="concat('get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs)"/>
  456. <xsl:attribute name="depends" select="concat('get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_check')"/>
  457. <xsl:attribute name="if" select="concat('${get_related_feature_run_child_ant',$loop_xpath_real,'_',$loop_path_recurs,'_test}')"/>
  458. <!--<xsl:attribute name="depends" select="concat('get_related_feature.',$RelatedFeaturePos,$loop_xpath_real,'_',$loop_path_recurs)"/>-->
  459. <!--<xsl:choose>
  460. <xsl:when test=".//(RelatedFeature|RelatedFeatureRoot)">
  461. <xsl:for-each select=".//RelatedFeature[ not(child::node()/name()='RelatedFeature')]">
  462. <xsl:variable name="loop_xpath_child_ant" select="concat($loop_xpath_save,'_x2f_.',@xml_id,'.',$featureID_name)"/>
  463. <xsl:message>#148 ustalamy $loop_xpath_child_ant=<xsl:value-of select="$loop_xpath_child_ant"/></xsl:message>
  464. <!-\- <xsl:element name="target">
  465. <xsl:attribute name="name" select="$loop_xpath_child_ant"/><!-\\-'get_related_feature_run_child_ant'-\\->
  466. <xsl:attribute name="depends" select="concat('get_related_feature.',$RelatedFeaturePos)"/>-\->
  467. <!-\-<ant antfile="temp/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.xml" dir="."/>-\->
  468. <ant antfile="temp/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml" dir="."/>
  469. <!-\-</xsl:element>-\->
  470. <xsl:if test=" position()=last()">
  471. <xsl:comment>Tu task z related</xsl:comment>
  472. </xsl:if>
  473. </xsl:for-each>
  474. </xsl:when>
  475. <xsl:otherwise>
  476. <xsl:comment>#135 nie ma wiecej //RelatedFeature</xsl:comment>
  477. <!-\-<xsl:element name="target">
  478. <xsl:attribute name="name" select="'get_related_feature_run_child_ant'"/>
  479. <xsl:attribute name="depends" select="concat('get_related_feature.',$RelatedFeaturePos)"/>
  480. </xsl:element>-\->
  481. </xsl:otherwise>
  482. </xsl:choose>-->
  483. <!-- wstawienie subanta dla biezacych dzieci only -->
  484. <!--<xsl:apply-templates mode="place_subant_RelatedFeatureLoop"> - ten nie potrzebuje generowac subantow - powinien go obsluzyc glowny
  485. <xsl:with-param name="uuid" select="$uuid"/>
  486. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  487. <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
  488. <xsl:with-param name="loop_path_recurs" select="$loop_path_recurs"/>
  489. </xsl:apply-templates>-->
  490. <ant antfile="{$basedir}/build.xml" target="xml_recursed_from_tr_map"/>
  491. </xsl:element>
  492. <!-- na koniec przetwarzania danego zaglebienia uruchamiamy calosc ponownie do kolejnego zaglebienia -->
  493. <!-- task do polaczenia zaglebien -->
  494. <!-- jak nie ma zaglebien to generujemy pdf i dajemy uzytkownikowi linka -->
  495. </project>
  496. </xsl:when>
  497. <xsl:otherwise>
  498. <xsl:apply-templates mode="child_nodes"/>
  499. </xsl:otherwise>
  500. </xsl:choose>
  501. </xsl:template>
  502. <!-- trzeba przetwarzac child_nodes do pierwszego napotkania RelatedFeature -->
  503. <xsl:template mode="child_nodes" match="*">
  504. <xsl:copy-of select="."/>
  505. </xsl:template>
  506. <!--<xsl:template mode="child_nodes" match="simpleTypeMakeOgcFilter">
  507. <xsl:message>#266 bypassing temporary simpleTypeMakeOgcFilter of problem with output </xsl:message>
  508. </xsl:template>-->
  509. <xsl:template mode="place_subant" match="RelatedFeature">
  510. <xsl:param name="uuid" required="yes"/>
  511. <xsl:param name="loop_xpath" required="yes"/>
  512. <xsl:param name="loop_xpath_real" required="yes"/>
  513. <!-- wygenerujemy liste ant -->
  514. <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>
  515. <fileset id="builds_to_ant{$loop_xpath_real}{@xml_id}" dir="{$temp}" includes="{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.*.xml" />
  516. <property name="builds_to_ant{$loop_xpath_real}{@xml_id}" refid="builds_to_ant{$loop_xpath_real}{@xml_id}"/>
  517. <!--<tempfile property="builds_to_ant.xml" deleteonexit="no" destdir="temp" suffix=".xml" prefix="${uuid}.builds_to_ant-"/>-->
  518. <xsl:element name="tempfile">
  519. <xsl:attribute name="property" select="concat('builds_to_ant.xml',$loop_xpath_real,@xml_id)"/>
  520. <xsl:attribute name="deleteonexit" select="'no'"/>
  521. <xsl:attribute name="destdir" select="$temp"/>
  522. <xsl:attribute name="suffix" select="'.xml'"/>
  523. <xsl:attribute name="prefix" select="concat('${uuid}.builds_to_ant-',@xml_id,'-')"/>
  524. </xsl:element>
  525. <!--<tempfile property="builds_to_ant_file.xml" deleteonexit="no" destdir="temp" suffix=".xml" prefix="${uuid}.build_to_ant_file-"/>-->
  526. <xsl:element name="tempfile">
  527. <xsl:attribute name="property" select="concat('builds_to_ant_file.xml',$loop_xpath_real,@xml_id)"/>
  528. <xsl:attribute name="deleteonexit" select="'no'"/>
  529. <xsl:attribute name="destdir" select="$temp"/>
  530. <xsl:attribute name="suffix" select="'.xml'"/>
  531. <xsl:attribute name="prefix" select="concat('${uuid}.build_to_ant_file-',@xml_id,'-')"/>
  532. </xsl:element>
  533. <echo>#235 ant do: builds_to_ant.xml=${builds_to_ant_file.xml} mode="place_subant" match="RelatedFeature" </echo>
  534. <!--<echoxml file="'${builds_to_ant.xml}'"><builds_to_ant>${builds_to_ant}</builds_to_ant></echoxml>-->
  535. <xsl:element name="echoxml">
  536. <xsl:attribute name="file" select="concat('${builds_to_ant.xml',$loop_xpath_real,@xml_id,'}')"/>
  537. <builds_to_ant>${builds_to_ant<xsl:value-of select="concat($loop_xpath_real,@xml_id)"/>}</builds_to_ant>
  538. </xsl:element>
  539. <xsl:element name="xslt">
  540. <xsl:attribute name="basedir" select="'./'"/>
  541. <xsl:attribute name="style" select="$builds_to_ant.xsl"/>
  542. <xsl:attribute name="in" select="concat('${builds_to_ant.xml',$loop_xpath_real,@xml_id,'}')"/>
  543. <xsl:attribute name="destdir" select="'./'"/>
  544. <xsl:attribute name="out" select="concat('${builds_to_ant_file.xml',$loop_xpath_real,@xml_id,'}')"/>
  545. <factory name="net.sf.saxon.TransformerFactoryImpl">
  546. <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
  547. <!--<attribute name="http://saxon.sf.net/feature/initialMode"
  548. value="after_first_ant_assing_vars"/>-->
  549. </factory>
  550. <param name="temp" expression="{$temp}"/>
  551. <param name="loop_xpath_real" expression="{$loop_xpath_real}{@xml_id}"/>
  552. <!--<xsl:element name="param">
  553. <xsl:attribute name="name" select="'default_antfile'"/>
  554. <xsl:attribute name="expression" select="concat($temp,'/',$builds_to_ant_file.xml"/>
  555. </xsl:element>-->
  556. <param name="default_antfile" expression="{$temp}/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml"/>
  557. <classpath location="/opt/local/share/java/saxon9he.jar"/>
  558. </xsl:element>
  559. <!--<ant antfile="{$temp}/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml" dir="."/>-->
  560. <xsl:element name="ant">
  561. <xsl:attribute name="antfile" select="concat('${builds_to_ant_file.xml',$loop_xpath_real,@xml_id,'}')"/>
  562. </xsl:element>
  563. <!--<ant antfile="{$temp}/${builds_to_ant_file.xml}" dir="."/>-->
  564. </xsl:template>
  565. <xsl:template mode="place_subant" match="RelatedFeatureLoop">
  566. <xsl:param name="uuid" required="yes"/>
  567. <xsl:param name="loop_xpath" required="yes"/>
  568. <xsl:param name="loop_xpath_real" required="yes"/>
  569. <xsl:param name="xpath_dita" required="yes"/>
  570. <xsl:param name="xpath_value_dita" required="yes"/>
  571. <!--<xsl:param name="loop_path_recurs" required="yes"/>-->
  572. <!-- wygenerujemy liste ant -->
  573. <xsl:comment>
  574. #590 LOOP BEGIN</xsl:comment>
  575. <echo> #523 RelatedFeatureLoop ant bede odpalac w podkatalogu:@xml_id=(<xsl:value-of select="@xml_id"/>)
  576. <xsl:value-of select="concat($temp,'/',@xml_id,'/',$uuid,'.build_',$loop_xpath,'_x2f_.',@xml_id,'.',substring-after(@typeName,':'),'.1.xml')"/> </echo>
  577. <xsl:message>#591 todo executing by exec instead of ant without inheritAll because it's looping!!! </xsl:message>
  578. <!-- Lista do wyzwolenia dzieci w podkalagach na bazie params-->
  579. <echo> #596 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>
  580. <dirset id="builds_to_ant{$loop_xpath_real}{@xml_id}" dir="{$temp}" includes="{@xml_id}.{$uuid}.*" />
  581. <property name="builds_to_ant{$loop_xpath_real}{@xml_id}" refid="builds_to_ant{$loop_xpath_real}{@xml_id}"/>
  582. <!--<tempfile property="builds_to_ant.xml" deleteonexit="no" destdir="temp" suffix=".xml" prefix="${uuid}.builds_to_ant-"/>-->
  583. <xsl:element name="tempfile">
  584. <xsl:attribute name="property" select="concat('builds_to_ant.xml',$loop_xpath_real,@xml_id)"/>
  585. <xsl:attribute name="deleteonexit" select="'no'"/>
  586. <xsl:attribute name="destdir" select="$temp"/>
  587. <xsl:attribute name="suffix" select="'.xml'"/>
  588. <xsl:attribute name="prefix" select="concat('${uuid}.builds_to_ant-loop-',@xml_id,'-')"/>
  589. </xsl:element>
  590. <!--<tempfile property="builds_to_ant_file.xml" deleteonexit="no" destdir="temp" suffix=".xml" prefix="${uuid}.build_to_ant_file-"/>-->
  591. <xsl:element name="tempfile">
  592. <xsl:attribute name="property" select="concat('builds_to_ant_file.xml',$loop_xpath_real,@xml_id)"/>
  593. <xsl:attribute name="deleteonexit" select="'no'"/>
  594. <xsl:attribute name="destdir" select="$temp"/>
  595. <xsl:attribute name="suffix" select="'.xml'"/>
  596. <xsl:attribute name="prefix" select="concat('${uuid}.build_to_ant_file-loop-',@xml_id,'-')"/>
  597. </xsl:element>
  598. <echo>#615 ant do: builds_to_ant.xml=${builds_to_ant_file.xml} mode="place_subant" match="RelatedFeature" </echo>
  599. <!--<echoxml file="'${builds_to_ant.xml}'"><builds_to_ant>${builds_to_ant}</builds_to_ant></echoxml>-->
  600. <xsl:element name="echoxml">
  601. <xsl:attribute name="file" select="concat('${builds_to_ant.xml',$loop_xpath_real,@xml_id,'}')"/>
  602. <builds_to_ant>${builds_to_ant<xsl:value-of select="concat($loop_xpath_real,@xml_id)"/>}</builds_to_ant>
  603. </xsl:element>
  604. <xsl:element name="xslt">
  605. <xsl:attribute name="basedir" select="'./'"/>
  606. <xsl:attribute name="style" select="$builds_to_ant.xsl"/>
  607. <xsl:attribute name="in" select="concat('${builds_to_ant.xml',$loop_xpath_real,@xml_id,'}')"/>
  608. <xsl:attribute name="destdir" select="'./'"/>
  609. <xsl:attribute name="out" select="concat('${builds_to_ant_file.xml',$loop_xpath_real,@xml_id,'}')"/>
  610. <factory name="net.sf.saxon.TransformerFactoryImpl">
  611. <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
  612. <attribute name="http://saxon.sf.net/feature/initialMode" value="exec"/>
  613. </factory>
  614. <param name="temp" expression="{$temp}"/>
  615. <param name="loop_xpath_real" expression="{$loop_xpath_real}{@xml_id}"/>
  616. <!--<xsl:element name="param">
  617. <xsl:attribute name="name" select="'default_antfile'"/>
  618. <xsl:attribute name="expression" select="concat($temp,'/',$builds_to_ant_file.xml"/>
  619. </xsl:element>-->
  620. <param name="default_antfile" expression="{$temp}/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml"/>
  621. <classpath location="/opt/local/share/java/saxon9he.jar"/>
  622. </xsl:element>
  623. <xsl:element name="ant">
  624. <xsl:attribute name="antfile" select="concat('${builds_to_ant_file.xml',$loop_xpath_real,@xml_id,'}')"/>
  625. </xsl:element>
  626. <!-- EOF Lista do wyzwolenia dzieci -->
  627. <!--<exec command="/opt/local/bin/ant" dir="{$temp}" failifexecutionfails="true">
  628. <!-\-<arg line="-f ${builds_to_ant_file.xml}"/>-\->
  629. <xsl:element name="arg">
  630. <xsl:attribute name="line" select="concat('-f ',@xml_id,'/',$uuid,'.build_',$loop_xpath,'_x2f_.',@xml_id,'.',substring-after(@typeName,':'),'.1.xml')"/>
  631. </xsl:element>
  632. </exec>-->
  633. <!--<xsl:element name="ant">
  634. <xsl:attribute name="antfile" select="concat($temp,'/',@xml_id,'/',$uuid,'.build_',$loop_xpath,'_x2f_.',@xml_id,'.',substring-after(@typeName,':'),'.1.xml')"/>
  635. <xsl:attribute name="inheritAll" select="'false'"/>
  636. <xsl:attribute name="inheritRefs" select="'false'"/>
  637. <property name="xpath" value="{$xpath_dita}"/>
  638. <property name="xpath_value_dita" value="{$xpath_value_dita}"/>
  639. </xsl:element>-->
  640. <!--<ant antfile="{$temp}/${builds_to_ant_file.xml}" dir="."/>-->
  641. <xsl:comment>#590 LOOP END
  642. </xsl:comment>
  643. </xsl:template>
  644. <xsl:template mode="place_subant" match="*">
  645. <xsl:param name="uuid" required="yes"/>
  646. <xsl:param name="loop_xpath" required="yes"/>
  647. <xsl:param name="loop_xpath_real" required="yes"/>
  648. <xsl:param name="xpath_dita" required="yes"/>
  649. <xsl:param name="xpath_value_dita" required="yes"/>
  650. <!--<xsl:param name="loop_path_recurs" required="yes"/>-->
  651. <xsl:apply-templates mode="place_subant">
  652. <xsl:with-param name="uuid" select="$uuid"/>
  653. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  654. <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
  655. <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
  656. <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
  657. <!--<xsl:with-param name="loop_path_recurs" select="$loop_path_recurs"/>-->
  658. </xsl:apply-templates>
  659. </xsl:template>
  660. <xsl:template mode="place_subant" match="text()|comment()"/>
  661. <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 -->
  662. <xsl:param name="input_obj_with_xpath" required="yes"/>
  663. <xsl:param name="xpath" required="yes"/>
  664. <xsl:param name="xpath_value" required="yes"/>
  665. <xsl:variable name="xpath_value_token">
  666. <xsl:for-each select=" tokenize($xpath_value,'/')">
  667. <xsl:message>#341 znalazlem dla=<xsl:value-of select="."/>; ; <xsl:value-of select="$input_obj_with_xpath/node()[@xpath=current()]"/></xsl:message>
  668. <xsl:if test="$input_obj_with_xpath/node()[@xpath=current()]">
  669. <xsl:copy-of select="$input_obj_with_xpath/node()[@xpath=current()]"/>
  670. </xsl:if><!-- todo to jest bledne ale dziala tymczasowo-->
  671. </xsl:for-each>
  672. </xsl:variable>
  673. <xsl:message>#345 ustalam na <xsl:value-of select="$xpath_value_token/node()[1]/text()"/>;</xsl:message>
  674. <!--<xsl:value-of select="$xpath_value_token/node()[1]/text()"/>-->
  675. <xsl:value-of select="$xpath_value_token"/>
  676. </xsl:template>
  677. <xsl:template match="RelatedFeature" mode="ant_target" >
  678. <xsl:param name="typeName_dita" required="yes"/>
  679. <xsl:param name="featureID_name_dita" required="yes"/>
  680. <xsl:param name="wfs_output" required="yes"/>
  681. <xsl:param name="wfs_output.xml" required="yes"/>
  682. <xsl:param name="wfs_output.dita" required="yes"/>
  683. <xsl:param name="xpath_dita" required="yes"/>
  684. <xsl:param name="xpath_value_dita" required="yes"/>
  685. <xsl:param name="xpath" required="yes"/>
  686. <xsl:param name="featureID_name" required="yes"/>
  687. <xsl:param name="RelatedFeatureCount" required="yes"/>
  688. <xsl:param name="RelatedFeaturePos" required="yes"/>
  689. <xsl:param name="typeName" required="yes"/>
  690. <xsl:param name="xpath_value" required="yes"/>
  691. <xsl:param name="loop_xpath" required="yes"/>
  692. <!--<xsl:param name="loop_xpath_save" required="yes"/>-->
  693. <xsl:param name="xml_id" required="yes"/>
  694. <xsl:param name="feature_pos" required="yes"/>
  695. <xsl:param name="loop_xpath_real" required="yes"/>
  696. <xsl:param name="input_obj_with_xpath" required="yes"/>
  697. <xsl:param name="typeNameRealResource" required="yes"/>
  698. <xsl:choose>
  699. <xsl:when test="$wfs_output"/>
  700. <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>
  701. </xsl:choose>
  702. <!-- template do przetworzenia dity w celu wykrycia:
  703. <RelatedFeature xpath="ID_BILLING_OWNER" typeName="p5_default_db:BILLING_OWNER">
  704. <ph>Nadawca:</ph><br/>
  705. <ph xpath="name1"/><br/>
  706. <ph xpath="name2"/><br/>
  707. <ph xpath="miasto"/><br/>
  708. <ph xpath="nr_rach"/><br/>
  709. <ph xpath="BILLING_OWNER_EMAIL"/><br/>
  710. </RelatedFeature>
  711. i wyrzucenia z tego pierwszego zadania ANT do otrzymania niezbednego .xml w celu jego podstawienia pod dite
  712. w celu pozniejszego ponownego wyzwolenia tego template az do zakonczenia cyklu finalnego.
  713. Template powinien budować projekt ant do wyzwolenia z odpowiednimi parametrami dalszymi
  714. -->
  715. <!-- sprawdzamy czy template pasuje do zadania wyzwolenia czy xpath=xpath_dita oraz czy typeName=typeName_dita-->
  716. <xsl:choose>
  717. <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 -->
  718. <!-- 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'-->
  719. <!--<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>-->
  720. <!--<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>-->
  721. <!--<xsl:variable name="OGC_Filter">
  722. <xsl:choose>
  723. <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>
  724. <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>
  725. </xsl:choose>
  726. </xsl:variable>-->
  727. <xsl:variable name="OGC_Filter">
  728. <xsl:call-template name="simpleTypeMakeOgcFilter_merge">
  729. <xsl:with-param name="simpleTypeMakeOgcFilter" select="simpleTypeMakeOgcFilter"/>
  730. <xsl:with-param name="RelatedFilter" select="RelatedFilter"/>
  731. <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
  732. <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
  733. </xsl:call-template>
  734. </xsl:variable>
  735. <xsl:message>#410 final OGC_Filter is <xsl:value-of select="$OGC_Filter"/>;</xsl:message>
  736. <xsl:variable name="url">
  737. <!--<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"/>-->
  738. <xsl:value-of select="$api_url"/>/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=<xsl:value-of select="$typeNameRealResource"/>&amp;SRSNAME=EPSG:3003<xsl:value-of select="$OGC_Filter"/>
  739. </xsl:variable>
  740. <xsl:element name="target">
  741. <xsl:attribute name="name" select="concat('get_related_feature.',position(),$loop_xpath_real)"/>
  742. <xsl:choose>
  743. <xsl:when test="$RelatedFeatureCount=$RelatedFeaturePos"/>
  744. <xsl:otherwise>
  745. <xsl:attribute name="depends" select="concat('get_related_feature.',position()-1),$loop_xpath_real"/>
  746. </xsl:otherwise>
  747. </xsl:choose>
  748. <!--<tempfile property="out_task.dita" deleteonexit="no" destdir="temp"/>-->
  749. <!--<tempfile property="wfs_output" deleteonexit="no" destdir="temp" suffix=".xml" />-->
  750. <xsl:element name="exec">
  751. <xsl:attribute name="executable" select="'curl'"/>
  752. <xsl:attribute name="output" select="concat($temp,'/',$wfs_output.xml)"/>
  753. <xsl:attribute name="errorproperty" select="'wfs_error'"/>
  754. <xsl:attribute name="resultproperty" select="'wfs_result'"/>
  755. <xsl:element name="arg">
  756. <!--<xsl:attribute name="line" select='concat("-H ","&amp;Authorization: Basic ",$passwordBase64Basic," ",$url)'/>-->
  757. <!--<xsl:attribute name="line">-H 'Authorization: Basic <xsl:value-of select="$passwordBase64Basic"/>' "<xsl:value-of select="$url"/>"</xsl:attribute>-->
  758. <xsl:attribute name="line"> <xsl:value-of select="$cookie_curl_option"/> "<xsl:value-of select="$url"/>"</xsl:attribute>
  759. </xsl:element>
  760. </xsl:element>
  761. <echo message="ERROR__START"/>
  762. <xsl:element name="echo">
  763. <xsl:attribute name="message">${wfs_error}</xsl:attribute>
  764. </xsl:element>
  765. <echo message="ERROR__END"/>
  766. <xsl:choose>
  767. <xsl:when test="position()=last()">
  768. <xsl:comment>antcall target="build_recurse_ant.<xsl:value-of select="position()+1"/>.xml"</xsl:comment>
  769. </xsl:when>
  770. <xsl:otherwise>
  771. <antcall target="build_recurse_ant.{position()+1}.xml"/>
  772. </xsl:otherwise>
  773. </xsl:choose>
  774. <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"/>;
  775. $temp is <xsl:value-of select="$temp"/>;</echo>
  776. <xsl:comment> teraz podmieniamy dane z otrzymanego xmla do pliku dita aby potem zrobic polaczony plik w kolejnym wyzwoleniu ant</xsl:comment>
  777. <delete file="{$temp}/{$wfs_output.dita}.vals.dita"/>
  778. <xslt basedir="./" style="{$build_recurse_ant.xsl}" in="{$temp}/{$wfs_output.dita}" destdir="./" out="{$temp}/{$wfs_output.dita}.vals.dita" >
  779. <factory name="net.sf.saxon.TransformerFactoryImpl">
  780. <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
  781. <attribute name="http://saxon.sf.net/feature/initialMode" value="after_first_ant_assing_vars"/>
  782. </factory>
  783. <classpath location="/opt/local/share/java/saxon9he.jar"/>
  784. <param name="wfs_output" expression="{$temp}/{$wfs_output.xml}"/>
  785. <param name="xpath" expression="{$xpath}" /> <!-- kontrolnie - nie potrzebne -->
  786. <param name="xpath_value" expression="{$xpath_value}" /> <!-- kontrolnie - nie potrzebne -->
  787. <param name="loop_xpath" expression="{$loop_xpath}"/>
  788. <param name="loop_xpath_save" expression="{$loop_xpath_save}"/>
  789. <param name="typeName" expression="{$typeName}"/><!-- kontrolnie - nie potrzebne -->
  790. <param name="uuid" expression="{$uuid}"/>
  791. <param name="basedir" expression="{$basedir}"/>
  792. <param name="build_recurse_ant.xsl" expression="{$build_recurse_ant.xsl}"/>
  793. <param name="passwordBase64Basic" expression="{$passwordBase64Basic}"/>
  794. <param name="feature_pos" expression="{$feature_pos}"/> <!-- aby wsadzic nr wezla do $wfs_output.dita.vals.dita -->
  795. <param name="build_recurse_ant.xsl" expression="{$build_recurse_ant.xsl}"/>
  796. <param name="temp" expression="{$temp}"/>
  797. <param name="builds_to_ant.xsl" expression="{$builds_to_ant.xsl}"/>
  798. <param name="cookie_curl_option" expression="{$cookie_curl_option}"/>
  799. <param name="api_url" expression="{$api_url}"/>
  800. <param name="loop_path_recurs" expression="{$loop_path_recurs}"/>
  801. </xslt>
  802. </xsl:element>
  803. <!-- zapisujemy wynik naszego biezacego przetwarzania dita element nizej do kolejnego przejechania z ant wyniku dla podstawienia danych -->
  804. <!-- blad - result jest po tym template -->
  805. <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>
  806. <!-- ten plik moze byc raz bo zawiera tylko mape do przeksztalcenia danego wezla -->
  807. <xsl:result-document href="{$wfs_output.dita}">
  808. <xsl:comment>current $feature_pos=<xsl:value-of select="$feature_pos"/>; $loop_xpath=<xsl:value-of select="$loop_xpath"/>;</xsl:comment>
  809. <!--<xsl:copy-of select="."/>-->
  810. <xsl:element name="{name()}">
  811. <xsl:copy-of select="@*"/>
  812. <xsl:attribute name="feature_pos" select="$feature_pos"/>
  813. <xsl:copy-of select="./*" exclude-result-prefixes="#all" copy-namespaces="no"/>
  814. </xsl:element>
  815. </xsl:result-document>
  816. <!--<xsl:choose>
  817. <xsl:when test="$feature_pos=1"><xsl:message>#327 propably first unaviable (<xsl:value-of select="$wfs_output.dita"/>) - writing</xsl:message>
  818. <xsl:result-document href="{$wfs_output.dita}">
  819. <xsl:comment>current $loop_xpath=<xsl:value-of select="$loop_xpath"/>;</xsl:comment>
  820. <xsl:copy-of select="."/></xsl:result-document>
  821. </xsl:when>
  822. <xsl:otherwise>
  823. <xsl:message>#227.1 probably exists file:<xsl:value-of select="$wfs_output.dita"/>; - bypassing </xsl:message>
  824. </xsl:otherwise>
  825. </xsl:choose>-->
  826. </xsl:when>
  827. <xsl:otherwise>
  828. <error>
  829. <xsl:attribute name="xpath" select="$xpath"/>
  830. <xsl:attribute name="xpath_dita" select="$xpath_dita"/>
  831. <xsl:attribute name="xpath_value" select="$xpath_value"/>
  832. <xsl:attribute name="xpath_value_dita" select="$xpath_value_dita"/>
  833. <xsl:attribute name="typeName" select="$typeName"/>
  834. <xsl:attribute name="typeName_dita" select="$typeName_dita"/>
  835. <xsl:attribute name="featureID_name" select="$featureID_name"/>
  836. <xsl:attribute name="featureID_name_dita" select="$featureID_name_dita"/>
  837. <echo message="OUTPUT__START"/>
  838. <echo>
  839. 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"/>)
  840. </echo>
  841. <echo message="OUTPUT__END"/>
  842. </error>
  843. </xsl:otherwise>
  844. </xsl:choose>
  845. </xsl:template>
  846. <xsl:template name="simpleTypeMakeOgcFilter_merge"><!-- do zrobienia polaczonego filtru OGC -->
  847. <xsl:param name="simpleTypeMakeOgcFilter" required="yes"/>
  848. <xsl:param name="xpath_dita" required="yes"/>
  849. <xsl:param name="xpath_value_dita" required="yes"/>
  850. <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>
  851. <!-- second step from local ant leaf -->
  852. <xsl:template match="RelatedFeature" mode="after_first_ant_assing_vars">
  853. <xsl:param name="loop_xpath" select="$loop_xpath"/>
  854. <RelatedFeatureRoot>
  855. <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>
  856. <!-- first assign xpath to features from -->
  857. <xsl:variable name="wfs_output_nodes" select="doc($wfs_output)"/>
  858. <xsl:variable name="current_RelatedFeature" select="*"/>
  859. <xsl:variable name="xml_id" select="@xml_id"/>
  860. <!--<input_obj_with_xpath_debug>
  861. <xsl:copy-of select="$wfs_output_nodes"/>
  862. </input_obj_with_xpath_debug>-->
  863. <xsl:message>#354 count($wfs_output_nodes//gml:featureMember) <xsl:value-of select="count($wfs_output_nodes//gml:featureMember)"/></xsl:message>
  864. <!-- tutaj jest blad przetwarzania ze wrzuca po rekordzie do kolumny - trzeba przetworzyc dla kazdego feature member -->
  865. <xsl:for-each select="$wfs_output_nodes//gml:featureMember">
  866. <xsl:variable name="input_obj_with_xpath">
  867. <xsl:apply-templates mode="after_first_ant_assing_xpath" select="node()/*"/> <!-- zeby nie wstawial do xpath nazwy feature - IN7_DZIENNIK_KORESP/ID itp -->
  868. </xsl:variable>
  869. <!--<input_obj_with_xpath_debug>
  870. <xsl:attribute name="xpath" select="$xpath"/>
  871. <!-\-<xsl:attribute name="xpath_dita" select="$xpath_dita"/>-\->
  872. <xsl:attribute name="xpath_value" select="$xpath_value"/>
  873. <!-\-<xsl:attribute name="xpath_value_dita" select="$xpath_value_dita"/>-\->
  874. <xsl:attribute name="typeName" select="$typeName"/>
  875. <!-\-<xsl:attribute name="typeName_dita" select="$typeName_dita"/>-\->
  876. <!-\-<xsl:attribute name="featureID_name" select="$featureID_name"/>-\->
  877. <!-\-<xsl:attribute name="featureID_name_dita" select="$featureID_name_dita"/>-\->
  878. <xsl:copy-of select="$input_obj_with_xpath"/>
  879. </input_obj_with_xpath_debug>-->
  880. <!--<input_node_debug>
  881. <xsl:copy-of select="."/>
  882. </input_node_debug>-->
  883. <xsl:apply-templates mode="after_first_ant_assing_vars_childs" select="$current_RelatedFeature">
  884. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  885. <xsl:with-param name="xml_id_parent" select="$xml_id"/>
  886. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  887. <xsl:with-param name="feature_pos" select="position()"/><!-- wiecej features z relacji dokladamy pozycje -->
  888. </xsl:apply-templates>
  889. </xsl:for-each>
  890. </RelatedFeatureRoot>
  891. </xsl:template>
  892. <xsl:template match="wfs:FeatureCollection|gml:featureMember" mode="after_first_ant_assing_xpath">
  893. <xsl:apply-templates mode="after_first_ant_assing_xpath"/>
  894. </xsl:template>
  895. <xsl:template mode="after_first_ant_assing_xpath" match="*">
  896. <xsl:param name="curr_xpath"/>
  897. <xsl:param name="loop_xpath" select="$loop_xpath"/>
  898. <xsl:choose>
  899. <xsl:when test="name()=$typeName">
  900. <xsl:apply-templates mode="after_first_ant_assing_xpath">
  901. <xsl:with-param name="curr_xpath" select="$curr_xpath"/>
  902. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  903. </xsl:apply-templates>
  904. </xsl:when>
  905. <xsl:otherwise>
  906. <xsl:variable name="curr_xpath_tmpl">
  907. <xsl:choose>
  908. <xsl:when test="$curr_xpath=''">
  909. <xsl:value-of select="local-name()"/> <!-- bylo local-name() - trzeba dorzucic xpath przechodzacy aby budowal sie w kwestii -->
  910. </xsl:when>
  911. <xsl:otherwise>
  912. <xsl:value-of select="concat($curr_xpath,'/',local-name())"/>
  913. </xsl:otherwise>
  914. </xsl:choose>
  915. </xsl:variable>
  916. <!--<xsl:variable name="curr_xpath_tmpl" select="'asdf'"/>-->
  917. <xsl:element name="{name()}">
  918. <xsl:attribute name="xpath" select="$curr_xpath_tmpl"/>
  919. <xsl:for-each select="@*">
  920. <xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute>
  921. </xsl:for-each>
  922. <xsl:value-of select="text()"/>
  923. <xsl:apply-templates mode="after_first_ant_assing_xpath">
  924. <xsl:with-param name="curr_xpath" select="$curr_xpath_tmpl"/>
  925. </xsl:apply-templates>
  926. </xsl:element>
  927. </xsl:otherwise>
  928. </xsl:choose>
  929. </xsl:template>
  930. <xsl:template match="text()" mode="after_first_ant_assing_xpath"/>
  931. <xsl:template match="simpleTypeMakeOgcFilter" mode="after_first_ant_assing_vars_childs">
  932. <xsl:message>#621 bypassing simpleTypeMakeOgcFilter in after_first_ant_assing_vars_childs</xsl:message>
  933. </xsl:template>
  934. <!-- przetwarzanie kolejne w celu podstawienia wartosci i wystawienia build dla kolejnych wezlow - problem z obsluga rownorzednie zagniezdzonych wezlow poprzez inne wezly -->
  935. <xsl:template match="*" mode="after_first_ant_assing_vars_childs">
  936. <xsl:param name="xml_id_parent" required="yes"/>
  937. <xsl:param name="loop_xpath" required="yes"/>
  938. <xsl:param name="input_obj_with_xpath" required="yes"/>
  939. <xsl:param name="feature_pos" required="yes"/>
  940. <xsl:for-each select=".">
  941. <xsl:choose>
  942. <!--<xsl:when test="node()='topic'">asdad</xsl:when>-->
  943. <!--<xsl:when test="name()='RelatedFeature'">
  944. <xsl:for-each select="data/apiname[@base='PROCES_INCLUDE']">
  945. <xsl:apply-templates mode="PROCES_INCLUDE">
  946. <xsl:with-param name="ID_PROCES" select="text()"/>
  947. </xsl:apply-templates>
  948. </xsl:for-each>
  949. </xsl:when>-->
  950. <!--<xsl:when test="name()='data-about'">
  951. <xsl:for-each select="data/apiname[@base='PROCES_INCLUDE']">
  952. <xsl:apply-templates mode="PROCES_INCLUDE">
  953. <xsl:with-param name="ID_PROCES" select="text()"/>
  954. </xsl:apply-templates>
  955. </xsl:for-each>
  956. </xsl:when>-->
  957. <xsl:when test="1=2"/>
  958. <xsl:otherwise>
  959. <xsl:element name="{name()}">
  960. <!--<xsl:copy-of select="namespace::node()"/>-->
  961. <xsl:for-each select="@*">
  962. <xsl:choose>
  963. <xsl:when test="name()='xpath'">
  964. <!--<xsl:attribute name="xpath_parsed" select="."/>-->
  965. <!--1:<xsl:value-of select="$parent_obj//node()[@system_cache__appinfo:xpath=$xpath]/text()"/>-->
  966. <!--<xsl:value-of select="$parent_obj//node()[local-name()=$xpath]/text()"/>-->
  967. <!--V:<xsl:value-of select="$xpath"/>-->
  968. </xsl:when>
  969. <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
  970. </xsl:choose>
  971. </xsl:for-each>
  972. <xsl:choose>
  973. <xsl:when test="@xpath">
  974. <!--<xsl:variable name="escaped_html_to_xml">
  975. <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
  976. <xsl:with-param name="html" select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]/text()"/>
  977. </xsl:call-template>
  978. </xsl:variable>-->
  979. <xsl:variable name="enter_to_ph">
  980. <xsl:apply-templates mode="enter_to_ph" select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]">
  981. <xsl:with-param name="count" select="count($input_obj_with_xpath/node()[local-name()=current()/@xpath])"/>
  982. <xsl:with-param name="element" select="name()"/>
  983. <!--<xsl:with-param name="xpath_token_filter" select="@xpath_token_filter"/>--><!-- mozliwosc wybrania pierwszego wyrazu np ' ' -->
  984. <!--<xsl:with-param name="xpath_token" select="@xpath_token"/>--><!-- mozliwosc wybrania pierwszego wyrazu np 1 -->
  985. </xsl:apply-templates>
  986. </xsl:variable>
  987. <xsl:variable name="enter_to_ph">
  988. <xsl:choose>
  989. <xsl:when test="@xpath_token_filter and @xpath_token ">
  990. <!-- implementacja filtra dla czegos oddzielonego parametrem -->
  991. <xsl:variable name="xpath_token_filter" select="tokenize($enter_to_ph,@xpath_token_filter)"/>
  992. <xsl:for-each select=" tokenize(@xpath_token,' ')">
  993. <xsl:variable name="xpath_token" select="number(.)"/>
  994. <xsl:copy-of select="$xpath_token_filter[$xpath_token]"></xsl:copy-of>
  995. </xsl:for-each>
  996. </xsl:when>
  997. <xsl:otherwise>
  998. <xsl:copy-of select="$enter_to_ph"/>
  999. </xsl:otherwise>
  1000. </xsl:choose>
  1001. </xsl:variable>
  1002. <xsl:copy-of select="$enter_to_ph"/>
  1003. </xsl:when>
  1004. </xsl:choose>
  1005. <xsl:value-of select="text()"/>
  1006. <xsl:apply-templates mode="after_first_ant_assing_vars_childs">
  1007. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  1008. <xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>
  1009. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  1010. <xsl:with-param name="feature_pos" select="$feature_pos"/>
  1011. </xsl:apply-templates>
  1012. </xsl:element>
  1013. </xsl:otherwise>
  1014. </xsl:choose>
  1015. </xsl:for-each>
  1016. </xsl:template>
  1017. <xsl:template match="RelatedFeature" mode="after_first_ant_assing_vars_childs">
  1018. <xsl:param name="input_obj_with_xpath" required="yes"/>
  1019. <xsl:param name="xml_id_parent" required="yes"/>
  1020. <xsl:param name="loop_xpath" select="$loop_xpath"/>
  1021. <xsl:param name="feature_pos" required="yes"/>
  1022. <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>
  1023. <!-- jest okazja do zrobienia bilda aby sciagnal rzeczy nizej -->
  1024. <xsl:variable name="featureID_name" select="substring-after(@typeName,':')"/>
  1025. <xsl:variable name="xml_id" select="@xml_id"/>
  1026. <xsl:variable name="loop_xpath" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>
  1027. <!--<xsl:variable name="loop_xpath_save" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>--> <!-- tutaj zapisal sie build z wezla z parent -->
  1028. <!--<debug_358_RelatedFeature>
  1029. <xsl:copy-of select="$input_obj_with_xpath"/>
  1030. </debug_358_RelatedFeature>-->
  1031. <!--<xsl:variable name="feature_pos">
  1032. <xsl:choose>
  1033. <xsl:when test="$feature_pos=1"/>
  1034. <xsl:otherwise><xsl:value-of select="$feature_pos"/></xsl:otherwise>
  1035. </xsl:choose>
  1036. </xsl:variable>-->
  1037. <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>
  1038. <xsl:result-document href="{$temp}/{$uuid}.build_{$loop_xpath}.{$feature_pos}.xml">
  1039. <xsl:apply-templates select=".">
  1040. <xsl:with-param name="typeName" select="@typeName"/>
  1041. <xsl:with-param name="xpath" select="@xpath"/>
  1042. <xsl:with-param name="xpath_value" select="@xpath_value"/>
  1043. <!--<xsl:with-param name="loop_xpath_save" select="$loop_xpath"/>-->
  1044. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  1045. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  1046. <xsl:with-param name="wfs_output" select="concat($uuid,'.',$loop_xpath)" />
  1047. <xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>
  1048. <xsl:with-param name="feature_pos" select="$feature_pos"/>
  1049. <xsl:with-param name="loop_path_recurs" select="$loop_path_recurs"/>
  1050. <!--<xsl:with-param name="wfs_output.xml" />-->
  1051. </xsl:apply-templates>
  1052. </xsl:result-document>
  1053. <xsl:element name="RelatedFeature">
  1054. <xsl:copy-of select="@*"/>
  1055. <xsl:attribute name="featureID_name" select="$featureID_name"/>
  1056. <xsl:attribute name="loop_xpath" select="$loop_xpath"/>
  1057. </xsl:element>
  1058. </xsl:template>
  1059. <xsl:template match="RelatedFeatureLoop" mode="after_first_ant_assing_vars_childs">
  1060. <xsl:param name="input_obj_with_xpath" required="yes"/>
  1061. <xsl:param name="xml_id_parent" required="yes"/>
  1062. <xsl:param name="loop_xpath" select="$loop_xpath"/>
  1063. <xsl:param name="feature_pos" required="yes"/>
  1064. <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>
  1065. <!-- jest okazja do zrobienia bilda aby sciagnal rzeczy nizej -->
  1066. <xsl:variable name="featureID_name" select="substring-after(@typeName,':')"/>
  1067. <xsl:variable name="xml_id" select="@xml_id"/>
  1068. <xsl:variable name="loop_xpath" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>
  1069. <!--<xsl:variable name="loop_xpath_save" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>--> <!-- tutaj zapisal sie build z wezla z parent -->
  1070. <!--<debug_358_RelatedFeature>
  1071. <xsl:copy-of select="$input_obj_with_xpath"/>
  1072. </debug_358_RelatedFeature>-->
  1073. <!--<xsl:variable name="feature_pos">
  1074. <xsl:choose>
  1075. <xsl:when test="$feature_pos=1"/>
  1076. <xsl:otherwise><xsl:value-of select="$feature_pos"/></xsl:otherwise>
  1077. </xsl:choose>
  1078. </xsl:variable>-->
  1079. <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>
  1080. <xsl:variable name="loop_path_recurs">
  1081. <xsl:choose>
  1082. <xsl:when test=" string-length($loop_path_recurs) &lt;1">
  1083. <xsl:value-of select="concat('/',@xml_id,'.',$uuid,'.',$feature_pos)"/>
  1084. </xsl:when>
  1085. <xsl:otherwise><xsl:value-of select="concat($loop_path_recurs,'/',@xml_id,'.',$uuid,'.',$feature_pos)"/></xsl:otherwise>
  1086. </xsl:choose>
  1087. </xsl:variable>
  1088. <xsl:result-document href="{$temp}/{@xml_id}.{$uuid}.{$feature_pos}/build_root.xml" >
  1089. <xsl:apply-templates select=".">
  1090. <xsl:with-param name="typeName" select="@typeName"/>
  1091. <xsl:with-param name="xpath" select="@xpath"/>
  1092. <xsl:with-param name="xpath_value" select="@xpath_value"/>
  1093. <!--<xsl:with-param name="loop_xpath_save" select="$loop_xpath"/>-->
  1094. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  1095. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  1096. <xsl:with-param name="wfs_output" select="concat($uuid,'.',$loop_xpath)" />
  1097. <xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>
  1098. <xsl:with-param name="feature_pos" select="$feature_pos"/>
  1099. <xsl:with-param name="loop_path_recurs" select="$loop_path_recurs"/>
  1100. <!--<xsl:with-param name="wfs_output.xml" />-->
  1101. </xsl:apply-templates>
  1102. </xsl:result-document>
  1103. <xsl:element name="RelatedFeatureLoop">
  1104. <xsl:copy-of select="@*"/>
  1105. <xsl:attribute name="featureID_name" select="$featureID_name"/>
  1106. <xsl:attribute name="loop_xpath" select="$loop_xpath"/>
  1107. </xsl:element>
  1108. </xsl:template>
  1109. <xsl:template match="text()" mode="after_first_ant_assing_vars_childs"/>
  1110. <xsl:template match="comment()" mode="after_first_ant_assing_vars_childs"/>
  1111. <!-- pozbieranie do kupy wszystkich xmli i zlozenie dity -->
  1112. <xsl:template match="*" mode="enter_to_ph">
  1113. <xsl:param name="count"/>
  1114. <xsl:param name="element"/>
  1115. <xsl:variable name="current" select="."/>
  1116. <xsl:variable name="surround_with">
  1117. <xsl:choose>
  1118. <xsl:when test="$element='p'"><xsl:value-of select="'codeblock'"/></xsl:when>
  1119. <xsl:when test="$element='bodydiv'"><xsl:value-of select="'p'"/></xsl:when>
  1120. <xsl:otherwise><xsl:value-of select="'codeblock'"/></xsl:otherwise>
  1121. </xsl:choose>
  1122. </xsl:variable>
  1123. <xsl:choose>
  1124. <xsl:when test=" contains( text(),'&#13;')">
  1125. <xsl:for-each select="tokenize( text(),'&#13;')">
  1126. <xsl:element name="{$surround_with}"><!-- to jest przetwarzane jak jest tekst lamany -->
  1127. <xsl:value-of select="."/>
  1128. </xsl:element>
  1129. </xsl:for-each>
  1130. </xsl:when>
  1131. <xsl:otherwise>
  1132. <xsl:choose>
  1133. <xsl:when test="$count &gt;1">
  1134. <codeblock>
  1135. <!--<xsl:attribute name="DDxpath" select="@xpath"/>-->
  1136. <!--DN(<xsl:value-of select="$element"/>)-->
  1137. <!--count:<xsl:value-of select="$count"/>-->
  1138. <xsl:copy-of select=" text()"/>
  1139. </codeblock>
  1140. </xsl:when>
  1141. <xsl:otherwise>
  1142. <xsl:apply-templates mode="enter_to_ph_text">
  1143. <xsl:with-param name="element" select="$element"/>
  1144. </xsl:apply-templates>
  1145. <!--<xsl:copy-of select=" text()"/>-->
  1146. </xsl:otherwise>
  1147. </xsl:choose>
  1148. </xsl:otherwise>
  1149. </xsl:choose>
  1150. </xsl:template>
  1151. <!-- dodanie enterow dla tabel w ktorych wyrazy sa dluzsze niz 10 znakow -->
  1152. <xsl:template match="text()" mode="enter_to_ph_text">
  1153. <xsl:param name="element" required="yes"/>
  1154. <xsl:choose>
  1155. <xsl:when test="$element='entry'">
  1156. <xsl:for-each select="tokenize(.,' ')">
  1157. <xsl:value-of select="' '"/>
  1158. <xsl:variable name="phrase" select="."/>
  1159. <xsl:for-each select="1 to string-length(.)">
  1160. <xsl:if test="position() mod 12 = 0"><xsl:value-of select="' -'"/></xsl:if>
  1161. <xsl:value-of select="substring($phrase,position(),1)"/>
  1162. </xsl:for-each>
  1163. </xsl:for-each>
  1164. </xsl:when>
  1165. <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
  1166. </xsl:choose>
  1167. </xsl:template>
  1168. </xsl:stylesheet>