build_recurse_ant.xsl 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  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. exclude-result-prefixes="xs"
  12. version="2.0">
  13. <xsl:output indent="yes" />
  14. <xsl:strip-space elements="*"/>
  15. <!-- Copyright BIALL-NET sp. z o.o. 2017-03-01 by Arkadiusz Binder wszelkie prawa zastrzeżone -->
  16. <!-- @2017-03-01 modyfikacja dla potrzeb CRM_PROCES_tree - sa bledy-->
  17. <xsl:include href="escaped_html_to_xml.xsl"/>
  18. <!--
  19. <property name="url" value="${url}"/> - to point what is record/table to download
  20. <property name="uuid" value="${uuid}"/> it is automatically also set to enable uinque transaction and to allow to save data with user
  21. <property name="passwordBase64Basic" value="${passwordBase64Basic}"/> - this is also set - to enable communicate with API -
  22. <property name="DwebRootUrl" value="${$webRootUrl}"/> - this is the place where script is localized to easyli to target user GUI by href to generated output -->
  23. <!-- variables to be set first by GUI first_request from executing API (php -> bash)-->
  24. <xsl:param name="uuid" required="yes" /> <!-- pewnie bedziemy ignorowac i dzialac na bazie ${'wfs_output'} ktory juz jest tempfilem -->
  25. <xsl:param name="passwordBase64Basic" required="yes" />
  26. <xsl:param name="url" />
  27. <xsl:param name="webRootUrl" />
  28. <xsl:param name="basedir" required="yes"/> <!-- aktualny katalog gdzie znajduja sie pliki temp -->
  29. <!--<xsl:param name="out_task.dita"/>--> <!-- nazwa temp docelowego zrodla do wykonania pliku pdf -->
  30. <!--<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 -->
  31. <!--<xsl:param name="wfs_output" select="concat('temp/wfs_output.',$uuid)"/>-->
  32. <!-- jak parametr jest to znaczy, ze przetwarzamy -->
  33. <xsl:param name="wfs_output" required="no"/> <!-- potem wfs_output.xml jak sciagnie nazwa temp sciagniecia z api xml forsowana przez pierwsze sciagniecie -->
  34. <xsl:param name="api_url" select="'https://biuro.biall-net.pl/SE/version-git/wfs-data.php'"/>
  35. <!--<xsl:param name="namespace_prefix" select="'p5_default_db'"/>-->
  36. <xsl:param name="typeName" required="yes" /> <!-- to be set initially ex: p5_default_db:IN7_DZIENNIK_KORESP -->
  37. <xsl:param name="xpath" required="yes" /> <!-- to be set initially ex: ID -->
  38. <xsl:param name="xpath_value" required="yes" /> <!-- to be set ex: 1000 -->
  39. <xsl:param name="loop_xpath" required="yes"/> <!-- sciezka do zapisywania xmli w przetwarzaniu plikow default root -->
  40. <xsl:param name="loop_xpath_save" required="yes"/> <!-- przekazany z template match="RelatedFeature" mode="after_first_ant_assing_vars_childs" -->
  41. <!-- static project variables as default styles.dita/xsl and names-->
  42. <xsl:param name="main_build_recurse_ant.dita" select="'main_build_recurse_ant.dita'"/>
  43. <xsl:param name="xml_id_parent" select="@xml_id"/>
  44. <xsl:param name="build_recurse_ant.xsl" required="yes"/>
  45. <xsl:param name="temp" select="'temp'"/>
  46. <xsl:param name="builds_to_ant.xsl" required="yes"/>
  47. <!-- second step fist loop - with data -->
  48. <!--<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 -->
  49. <!-- opis dzialania template dla przetwarzania wezlow na podstawie schematu i budowania zagniezdzonego pliku xml z
  50. instancjami na podstawie tego samego schematu
  51. wyzwolenie inicjalizujace z build.xml buduje "wyzwolenie glowne" gdzie na output daje wynikowy build.
  52. system wyzwala dwa etapy
  53. wyzwolenie glowne - do okreslenia zaleznosci wezla i zbudowania zapytania o dane
  54. wyzwolenie after_first_ant_assing_vars - do podstawienia danych z wyzwolenia poprzedniego oraz przygotowania build "dla kolejnego X" do wyzwolenia glownego
  55. wyzwolenie glowne - szuka pierwszego RelatedFeature, ktore zawsze domyslnie jest na poczatku template, potem w nim grzebie - jak znajdzie - wchodzi w dol
  56. w ramach tego wyzwolenia przygotowuje task dla biezecego przygotowania ant_build - mode ant_target
  57. w ramach tego wyzwolenia juz musi przeanalizowac jakie sa dalsze zadania do wyzwolenia "dla kolejnego X' ant_build -
  58. 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
  59. wyzwolenie after_first_ant_assing_vars - to wyzwile
  60. to wyzwolenie podstawia dane do dita.vals.xml w celu zlozenia pliku wyjsciowego
  61. to wyzwolenie powinno juz zrobic ant_buildy "dla kolejnego X'
  62. to wyzwolenie korzysta z apply-templates wyzwolenia glownego, w celu przygotowania ant_build
  63. -->
  64. <xsl:template match="*">
  65. <xsl:param name="typeName" select="$typeName" />
  66. <xsl:param name="xpath" select="$xpath" />
  67. <xsl:param name="xpath_value" select="$xpath_value" />
  68. <xsl:param name="loop_xpath" select="$loop_xpath"/>
  69. <xsl:param name="loop_xpath_save" select="$loop_xpath_save"/><!-- tutaj zapisal sie build z wezla z parent -->
  70. <xsl:param name="input_obj_with_xpath" /> <!-- przekazany z template match="RelatedFeature" mode="after_first_ant_assing_vars_childs" -->
  71. <xsl:param name="feature_pos" select="1"/> <!-- przekazany z template match="RelatedFeature" mode="after_first_ant_assing_vars_childs"-->
  72. <xsl:choose>
  73. <xsl:when test="name()='RelatedFeature'">
  74. <xsl:variable name="RelatedFeatureCount" select="last()"/>
  75. <xsl:variable name="RelatedFeaturePos" select="position()"/>
  76. <xsl:variable name="featureID_name" select="substring-after($typeName,':')"/>
  77. <xsl:message>#58 bylo $loop_xpath=<xsl:value-of select="$loop_xpath"/>; $basedir=<xsl:value-of select="$basedir"/>; </xsl:message>
  78. <xsl:variable name="loop_xpath_real" select="$loop_xpath"/>
  79. <xsl:variable name="loop_xpath">
  80. <xsl:choose>
  81. <xsl:when test="$loop_xpath='root'">
  82. <xsl:value-of select="concat($loop_xpath,'_x2f_.',@xml_id,'.',$featureID_name)"/>
  83. </xsl:when>
  84. <xsl:otherwise><xsl:value-of select="$loop_xpath"/></xsl:otherwise>
  85. </xsl:choose>
  86. </xsl:variable>
  87. <xsl:variable name="typeName_dita" select="@typeName"/>
  88. <xsl:variable name="featureID_name_dita" select="substring-after($typeName_dita,':')"/>
  89. <xsl:variable name="xml_id" select="@xml_id"/>
  90. <!--<xsl:variable name="wfs_output" select="concat($uuid,'.',$loop_xpath,'_x2f_',$featureID_name)"/>-->
  91. <xsl:variable name="wfs_output" select="concat($uuid,'.',$loop_xpath)"/>
  92. <!--<xsl:variable name="wfs_output.xml" select="concat($wfs_output,'.',position(),'.xml')"/>-->
  93. <xsl:variable name="wfs_output.xml" select="concat($wfs_output,'.',position(),'.',$feature_pos,'.xml')"/>
  94. <xsl:variable name="wfs_output.dita" select="concat($wfs_output,'.',position(),'.',$feature_pos,'.dita.xml')"/>
  95. <!--<xsl:variable name="wfs_output.dita" select="concat($wfs_output,'.',position(),'.','.dita.xml')"/>-->
  96. <!-- dane z oczekiwanego template .dita -->
  97. <xsl:variable name="xpath_dita" select="@xpath"/>
  98. <xsl:variable name="xpath_value_dita">
  99. <xsl:choose>
  100. <xsl:when test="@xpath_value">
  101. <!--<xsl:variable name="xpath_value_tokens" select="tokenize(@xpath_value,'/')"/>-->
  102. <!--<xsl:value-of select="'todo zapytanie xpath do przetworzenia'"/>-->
  103. <!--<xsl:copy-of select="$xpath_value_tokens"></xsl:copy-of>-->
  104. <!--<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>-->
  105. <xsl:message>#67.1 $input_obj_with_xpath: <xsl:copy-of select="$input_obj_with_xpath"/> </xsl:message>
  106. <xsl:variable name="xpath_value_token">
  107. <xsl:for-each select=" tokenize(@xpath_value,'/')">
  108. <xsl:message>#70 znalazlem dla=<xsl:value-of select="."/>; ; <xsl:value-of select="$input_obj_with_xpath/node()[@xpath=current()]"/></xsl:message>
  109. <xsl:if test="$input_obj_with_xpath/node()[@xpath=current()]">
  110. <xsl:copy-of select="$input_obj_with_xpath/node()[@xpath=current()]"/>
  111. </xsl:if><!-- todo to jest bledne ale dziala tymczasowo-->
  112. </xsl:for-each>
  113. </xsl:variable>
  114. <xsl:message>#73 ustalam na <xsl:value-of select="$xpath_value_token/node()[1]/text()"/>;</xsl:message>
  115. <!--<xsl:value-of select="$xpath_value_token/node()[1]/text()"/>-->
  116. <xsl:value-of select="$xpath_value_token"/>
  117. </xsl:when>
  118. <xsl:otherwise>
  119. <xsl:value-of select="$xpath_value"/><!-- parametr z template narzuca wartosc -->
  120. </xsl:otherwise>
  121. </xsl:choose>
  122. </xsl:variable>
  123. <xsl:message>#71 wstawiam projekt $feature_pos=<xsl:value-of select="$feature_pos"/>; $loop_xpath=<xsl:value-of select="$loop_xpath"/>; </xsl:message>
  124. <project basedir="../." name="get_related_feature{$loop_xpath_real}" default="get_related_feature_run_child_ant{$loop_xpath_real}">
  125. <xsl:comment>RelatedFeatureCount:<xsl:value-of select="count(*)"/></xsl:comment>
  126. <echo> ANT Uruchamiam $feature_pos=<xsl:value-of select="$feature_pos"/>; projekt <xsl:value-of select="$loop_xpath_real"/>; </echo>
  127. <!--<xsl:variable name="typeName" select='replace($typeName,"&quot;","")'/>--><!-- oczyszczenie z apostrofow -->
  128. <xsl:element name="property">
  129. <xsl:attribute name="name" select="'uuid'"/>
  130. <xsl:attribute name="value" select="$uuid"/>
  131. </xsl:element>
  132. <xsl:element name="property">
  133. <xsl:attribute name="name" select="'passwordBase64Basic'"/>
  134. <xsl:attribute name="value" select="$passwordBase64Basic"/>
  135. </xsl:element>
  136. <xsl:element name="property">
  137. <xsl:attribute name="name" select="'url'"/>
  138. <xsl:attribute name="value" select="$url"/>
  139. </xsl:element>
  140. <xsl:element name="property">
  141. <xsl:attribute name="name" select="'webRootUrl'"/>
  142. <xsl:attribute name="value" select="$webRootUrl"/>
  143. </xsl:element>
  144. <xsl:element name="property">
  145. <xsl:attribute name="name" select="'build_recurse_ant.xsl'"/>
  146. <xsl:attribute name="value" select="$build_recurse_ant.xsl"/>
  147. </xsl:element>
  148. <xsl:element name="property">
  149. <xsl:attribute name="name" select="'temp'"/>
  150. <xsl:attribute name="value" select="$temp"/>
  151. </xsl:element>
  152. <xsl:element name="property">
  153. <xsl:attribute name="name" select="'builds_to_ant.xsl'"/>
  154. <xsl:attribute name="value" select="$builds_to_ant.xsl"/>
  155. </xsl:element>
  156. <xsl:comment>
  157. Important variables:
  158. typeName=<xsl:value-of select="$typeName"/>;
  159. xpath=<xsl:value-of select="$xpath"/>;
  160. xpath_value=<xsl:value-of select="$xpath_value"/>;
  161. $passwordBase64Basic=<xsl:value-of select="$passwordBase64Basic"/>
  162. </xsl:comment>
  163. <xsl:apply-templates mode="ant_target" select=".">
  164. <xsl:with-param name="typeName_dita" select="$typeName_dita"/>
  165. <xsl:with-param name="featureID_name_dita" select="$featureID_name_dita"/>
  166. <xsl:with-param name="wfs_output" select="$wfs_output"/>
  167. <xsl:with-param name="wfs_output.xml" select="$wfs_output.xml"/>
  168. <xsl:with-param name="wfs_output.dita" select="$wfs_output.dita"/>
  169. <xsl:with-param name="xpath" select="$xpath"/>
  170. <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
  171. <xsl:with-param name="featureID_name" select="$featureID_name"/>
  172. <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
  173. <xsl:with-param name="RelatedFeatureCount" select="$RelatedFeatureCount"/>
  174. <xsl:with-param name="RelatedFeaturePos" select="$RelatedFeaturePos"/>
  175. <xsl:with-param name="typeName" select="$typeName"/>
  176. <xsl:with-param name="xpath_value" select="$xpath_value"/>
  177. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  178. <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
  179. <!--<xsl:with-param name="loop_xpath_save" select="$loop_xpath_save"/>-->
  180. <xsl:with-param name="xml_id" select="$xml_id"/>
  181. <!--<xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>-->
  182. <xsl:with-param name="feature_pos" select="$feature_pos"/>
  183. </xsl:apply-templates>
  184. <!-- na koniec przetwarzania kazdego z wezlow, podmieniamy xsl biezacy wezel -->
  185. <xsl:comment>template match="RelatedFeature" mode="after_first_ant_assing_vars_childs"
  186. robi result-document href="build_{$loop_xpath}.{$uuid}.xml
  187. wiec powinnismy uruchomic ant ten plik w ciemno znajac jego nizsze wezly</xsl:comment>
  188. <xsl:variable name="featureID_name_child" select="substring-after($typeName,':')"/>
  189. <xsl:variable name="loop_xpath_child" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>
  190. <xsl:message>#142 ustalamy $loop_xpath_child=<xsl:value-of select="$loop_xpath_child"/></xsl:message>
  191. <xsl:element name="target">
  192. <xsl:attribute name="name" select="concat('get_related_feature_run_child_ant',$loop_xpath_real)"/>
  193. <xsl:attribute name="depends" select="concat('get_related_feature.',$RelatedFeaturePos,$loop_xpath_real)"/>
  194. <!--<xsl:choose>
  195. <xsl:when test=".//(RelatedFeature|RelatedFeatureRoot)">
  196. <xsl:for-each select=".//RelatedFeature[ not(child::node()/name()='RelatedFeature')]">
  197. <xsl:variable name="loop_xpath_child_ant" select="concat($loop_xpath_save,'_x2f_.',@xml_id,'.',$featureID_name)"/>
  198. <xsl:message>#148 ustalamy $loop_xpath_child_ant=<xsl:value-of select="$loop_xpath_child_ant"/></xsl:message>
  199. <!-\- <xsl:element name="target">
  200. <xsl:attribute name="name" select="$loop_xpath_child_ant"/><!-\\-'get_related_feature_run_child_ant'-\\->
  201. <xsl:attribute name="depends" select="concat('get_related_feature.',$RelatedFeaturePos)"/>-\->
  202. <!-\-<ant antfile="temp/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.xml" dir="."/>-\->
  203. <ant antfile="temp/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml" dir="."/>
  204. <!-\-</xsl:element>-\->
  205. <xsl:if test=" position()=last()">
  206. <xsl:comment>Tu task z related</xsl:comment>
  207. </xsl:if>
  208. </xsl:for-each>
  209. </xsl:when>
  210. <xsl:otherwise>
  211. <xsl:comment>#135 nie ma wiecej //RelatedFeature</xsl:comment>
  212. <!-\-<xsl:element name="target">
  213. <xsl:attribute name="name" select="'get_related_feature_run_child_ant'"/>
  214. <xsl:attribute name="depends" select="concat('get_related_feature.',$RelatedFeaturePos)"/>
  215. </xsl:element>-\->
  216. </xsl:otherwise>
  217. </xsl:choose>-->
  218. <!-- wstawienie subanta dla biezacych dzieci only -->
  219. <xsl:apply-templates mode="place_subant">
  220. <xsl:with-param name="uuid" select="$uuid"/>
  221. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  222. <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
  223. </xsl:apply-templates>
  224. </xsl:element>
  225. <!-- na koniec przetwarzania danego zaglebienia uruchamiamy calosc ponownie do kolejnego zaglebienia -->
  226. <!-- task do polaczenia zaglebien -->
  227. <!-- jak nie ma zaglebien to generujemy pdf i dajemy uzytkownikowi linka -->
  228. </project>
  229. </xsl:when>
  230. <xsl:otherwise>
  231. <xsl:apply-templates mode="child_nodes"/>
  232. </xsl:otherwise>
  233. </xsl:choose>
  234. </xsl:template>
  235. <!-- trzeba przetwarzac child_nodes do pierwszego napotkania RelatedFeature -->
  236. <xsl:template mode="child_nodes" match="*">
  237. <xsl:copy-of select="."/>
  238. </xsl:template>
  239. <xsl:template mode="place_subant" match="RelatedFeature">
  240. <xsl:param name="uuid" required="yes"/>
  241. <xsl:param name="loop_xpath" required="yes"/>
  242. <xsl:param name="loop_xpath_real" required="yes"/>
  243. <!-- wygenerujemy liste ant -->
  244. <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>
  245. <fileset id="builds_to_ant{$loop_xpath_real}{@xml_id}" dir="temp" includes="{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.*.xml" />
  246. <property name="builds_to_ant{$loop_xpath_real}{@xml_id}" refid="builds_to_ant{$loop_xpath_real}{@xml_id}"/>
  247. <!--<tempfile property="builds_to_ant.xml" deleteonexit="no" destdir="temp" suffix=".xml" prefix="${uuid}.builds_to_ant-"/>-->
  248. <xsl:element name="tempfile">
  249. <xsl:attribute name="property" select="concat('builds_to_ant.xml',$loop_xpath_real,@xml_id)"/>
  250. <xsl:attribute name="deleteonexit" select="'no'"/>
  251. <xsl:attribute name="destdir" select="'temp'"/>
  252. <xsl:attribute name="suffix" select="'.xml'"/>
  253. <xsl:attribute name="prefix" select="concat('${uuid}.builds_to_ant-',@xml_id,'-')"/>
  254. </xsl:element>
  255. <!--<tempfile property="builds_to_ant_file.xml" deleteonexit="no" destdir="temp" suffix=".xml" prefix="${uuid}.build_to_ant_file-"/>-->
  256. <xsl:element name="tempfile">
  257. <xsl:attribute name="property" select="concat('builds_to_ant_file.xml',$loop_xpath_real,@xml_id)"/>
  258. <xsl:attribute name="deleteonexit" select="'no'"/>
  259. <xsl:attribute name="destdir" select="'temp'"/>
  260. <xsl:attribute name="suffix" select="'.xml'"/>
  261. <xsl:attribute name="prefix" select="concat('${uuid}.build_to_ant_file-',@xml_id,'-')"/>
  262. </xsl:element>
  263. <echo>#235 ant do: builds_to_ant.xml=${builds_to_ant_file.xml} mode="place_subant" match="RelatedFeature" </echo>
  264. <!--<echoxml file="'${builds_to_ant.xml}'"><builds_to_ant>${builds_to_ant}</builds_to_ant></echoxml>-->
  265. <xsl:element name="echoxml">
  266. <xsl:attribute name="file" select="concat('${builds_to_ant.xml',$loop_xpath_real,@xml_id,'}')"/>
  267. <builds_to_ant>${builds_to_ant<xsl:value-of select="concat($loop_xpath_real,@xml_id)"/>}</builds_to_ant>
  268. </xsl:element>
  269. <xsl:element name="xslt">
  270. <xsl:attribute name="basedir" select="'./'"/>
  271. <xsl:attribute name="style" select="$builds_to_ant.xsl"/>
  272. <xsl:attribute name="in" select="concat('${builds_to_ant.xml',$loop_xpath_real,@xml_id,'}')"/>
  273. <xsl:attribute name="destdir" select="'./'"/>
  274. <xsl:attribute name="out" select="concat('${builds_to_ant_file.xml',$loop_xpath_real,@xml_id,'}')"/>
  275. <factory name="net.sf.saxon.TransformerFactoryImpl">
  276. <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
  277. <!--<attribute name="http://saxon.sf.net/feature/initialMode"
  278. value="after_first_ant_assing_vars"/>-->
  279. </factory>
  280. <param name="temp" expression="{$temp}"/>
  281. <param name="loop_xpath_real" expression="{$loop_xpath_real}{@xml_id}"/>
  282. <!--<xsl:element name="param">
  283. <xsl:attribute name="name" select="'default_antfile'"/>
  284. <xsl:attribute name="expression" select="concat($temp,'/',$builds_to_ant_file.xml"/>
  285. </xsl:element>-->
  286. <param name="default_antfile" expression="{$temp}/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml"/>
  287. <classpath location="/opt/local/share/java/saxon9he.jar"/>
  288. </xsl:element>
  289. <!--<ant antfile="{$temp}/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml" dir="."/>-->
  290. <xsl:element name="ant">
  291. <xsl:attribute name="antfile" select="concat('${builds_to_ant_file.xml',$loop_xpath_real,@xml_id,'}')"/>
  292. </xsl:element>
  293. <!--<ant antfile="{$temp}/${builds_to_ant_file.xml}" dir="."/>-->
  294. </xsl:template>
  295. <xsl:template mode="place_subant" match="*">
  296. <xsl:param name="uuid" required="yes"/>
  297. <xsl:param name="loop_xpath" required="yes"/>
  298. <xsl:param name="loop_xpath_real" required="yes"/>
  299. <xsl:apply-templates mode="place_subant">
  300. <xsl:with-param name="uuid" select="$uuid"/>
  301. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  302. <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
  303. </xsl:apply-templates>
  304. </xsl:template>
  305. <xsl:template mode="place_subant" match="text()|comment()"/>
  306. <xsl:template match="RelatedFeature" mode="ant_target" >
  307. <xsl:param name="typeName_dita" required="yes"/>
  308. <xsl:param name="featureID_name_dita" required="yes"/>
  309. <xsl:param name="wfs_output" required="yes"/>
  310. <xsl:param name="wfs_output.xml" required="yes"/>
  311. <xsl:param name="wfs_output.dita" required="yes"/>
  312. <xsl:param name="xpath_dita" required="yes"/>
  313. <xsl:param name="xpath_value_dita" required="yes"/>
  314. <xsl:param name="xpath" required="yes"/>
  315. <xsl:param name="featureID_name" required="yes"/>
  316. <xsl:param name="RelatedFeatureCount" required="yes"/>
  317. <xsl:param name="RelatedFeaturePos" required="yes"/>
  318. <xsl:param name="typeName" required="yes"/>
  319. <xsl:param name="xpath_value" required="yes"/>
  320. <xsl:param name="loop_xpath" required="yes"/>
  321. <!--<xsl:param name="loop_xpath_save" required="yes"/>-->
  322. <xsl:param name="xml_id" required="yes"/>
  323. <xsl:param name="feature_pos" required="yes"/>
  324. <xsl:param name="loop_xpath_real" required="yes"/>
  325. <xsl:choose>
  326. <xsl:when test="$wfs_output"/>
  327. <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>
  328. </xsl:choose>
  329. <!-- template do przetworzenia dity w celu wykrycia:
  330. <RelatedFeature xpath="ID_BILLING_OWNER" typeName="p5_default_db:BILLING_OWNER">
  331. <ph>Nadawca:</ph><br/>
  332. <ph xpath="name1"/><br/>
  333. <ph xpath="name2"/><br/>
  334. <ph xpath="miasto"/><br/>
  335. <ph xpath="nr_rach"/><br/>
  336. <ph xpath="BILLING_OWNER_EMAIL"/><br/>
  337. </RelatedFeature>
  338. i wyrzucenia z tego pierwszego zadania ANT do otrzymania niezbednego .xml w celu jego podstawienia pod dite
  339. w celu pozniejszego ponownego wyzwolenia tego template az do zakonczenia cyklu finalnego.
  340. Template powinien budować projekt ant do wyzwolenia z odpowiednimi parametrami dalszymi
  341. -->
  342. <!-- sprawdzamy czy template pasuje do zadania wyzwolenia czy xpath=xpath_dita oraz czy typeName=typeName_dita-->
  343. <xsl:choose>
  344. <xsl:when test="string($xpath_dita)= string($xpath) and string($featureID_name)=string($featureID_name_dita)">
  345. <!-- 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'-->
  346. <!--<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>-->
  347. <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>
  348. <xsl:variable name="url">
  349. <!--<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"/>-->
  350. <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"/>
  351. </xsl:variable>
  352. <xsl:element name="target">
  353. <xsl:attribute name="name" select="concat('get_related_feature.',position(),$loop_xpath_real)"/>
  354. <xsl:choose>
  355. <xsl:when test="$RelatedFeatureCount=$RelatedFeaturePos"/>
  356. <xsl:otherwise>
  357. <xsl:attribute name="depends" select="concat('get_related_feature.',position()-1),$loop_xpath_real"/>
  358. </xsl:otherwise>
  359. </xsl:choose>
  360. <!--<tempfile property="out_task.dita" deleteonexit="no" destdir="temp"/>-->
  361. <!--<tempfile property="wfs_output" deleteonexit="no" destdir="temp" suffix=".xml" />-->
  362. <xsl:element name="exec">
  363. <xsl:attribute name="executable" select="'curl'"/>
  364. <xsl:attribute name="output" select="concat('temp/',$wfs_output.xml)"/>
  365. <xsl:attribute name="errorproperty" select="'wfs_error'"/>
  366. <xsl:attribute name="resultproperty" select="'wfs_result'"/>
  367. <xsl:element name="arg">
  368. <!--<xsl:attribute name="line" select='concat("-H ","&amp;Authorization: Basic ",$passwordBase64Basic," ",$url)'/>-->
  369. <xsl:attribute name="line">-H 'Authorization: Basic <xsl:value-of select="$passwordBase64Basic"/>' "<xsl:value-of select="$url"/>"</xsl:attribute>
  370. </xsl:element>
  371. </xsl:element>
  372. <echo message="ERROR__START"/>
  373. <xsl:element name="echo">
  374. <xsl:attribute name="message">${wfs_error}</xsl:attribute>
  375. </xsl:element>
  376. <echo message="ERROR__END"/>
  377. <xsl:choose>
  378. <xsl:when test="position()=last()">
  379. <xsl:comment>antcall target="build_recurse_ant.<xsl:value-of select="position()+1"/>.xml"</xsl:comment>
  380. </xsl:when>
  381. <xsl:otherwise>
  382. <antcall target="build_recurse_ant.{position()+1}.xml"/>
  383. </xsl:otherwise>
  384. </xsl:choose>
  385. <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"/>;</echo>
  386. <xsl:comment> teraz podmieniamy dane z otrzymanego xmla do pliku dita aby potem zrobic polaczony plik w kolejnym wyzwoleniu ant</xsl:comment>
  387. <delete file="temp/{$wfs_output.dita}.vals.dita"/>
  388. <xslt basedir="./" style="{$build_recurse_ant.xsl}" in="temp/{$wfs_output.dita}" destdir="./" out="temp/{$wfs_output.dita}.vals.dita" >
  389. <factory name="net.sf.saxon.TransformerFactoryImpl">
  390. <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
  391. <attribute name="http://saxon.sf.net/feature/initialMode" value="after_first_ant_assing_vars"/>
  392. </factory>
  393. <classpath location="/opt/local/share/java/saxon9he.jar"/>
  394. <param name="wfs_output" expression="{$basedir}/temp/{$wfs_output.xml}"/>
  395. <param name="xpath" expression="{$xpath}" /> <!-- kontrolnie - nie potrzebne -->
  396. <param name="xpath_value" expression="{$xpath_value}" /> <!-- kontrolnie - nie potrzebne -->
  397. <param name="loop_xpath" expression="{$loop_xpath}"/>
  398. <param name="loop_xpath_save" expression="{$loop_xpath_save}"/>
  399. <param name="typeName" expression="{$typeName}"/><!-- kontrolnie - nie potrzebne -->
  400. <param name="uuid" expression="{$uuid}"/>
  401. <param name="basedir" expression="{$basedir}"/>
  402. <param name="build_recurse_ant.xsl" expression="{$build_recurse_ant.xsl}"/>
  403. <param name="passwordBase64Basic" expression="{$passwordBase64Basic}"/>
  404. <param name="feature_pos" expression="{$feature_pos}"/> <!-- aby wsadzic nr wezla do $wfs_output.dita.vals.dita -->
  405. <param name="build_recurse_ant.xsl" expression="{$build_recurse_ant.xsl}"/>
  406. <param name="temp" expression="{$temp}"/>
  407. <param name="builds_to_ant.xsl" expression="{$builds_to_ant.xsl}"/>
  408. </xslt>
  409. </xsl:element>
  410. <!-- zapisujemy wynik naszego biezacego przetwarzania dita element nizej do kolejnego przejechania z ant wyniku dla podstawienia danych -->
  411. <!-- blad - result jest po tym template -->
  412. <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>
  413. <!-- ten plik moze byc raz bo zawiera tylko mape do przeksztalcenia danego wezla -->
  414. <xsl:result-document href="{$wfs_output.dita}">
  415. <xsl:comment>current $feature_pos=<xsl:value-of select="$feature_pos"/>; $loop_xpath=<xsl:value-of select="$loop_xpath"/>;</xsl:comment>
  416. <!--<xsl:copy-of select="."/>-->
  417. <xsl:element name="{name()}">
  418. <xsl:copy-of select="@*"/>
  419. <xsl:attribute name="feature_pos" select="$feature_pos"/>
  420. <xsl:copy-of select="./*" exclude-result-prefixes="#all" copy-namespaces="no"/>
  421. </xsl:element>
  422. </xsl:result-document>
  423. <!--<xsl:choose>
  424. <xsl:when test="$feature_pos=1"><xsl:message>#327 propably first unaviable (<xsl:value-of select="$wfs_output.dita"/>) - writing</xsl:message>
  425. <xsl:result-document href="{$wfs_output.dita}">
  426. <xsl:comment>current $loop_xpath=<xsl:value-of select="$loop_xpath"/>;</xsl:comment>
  427. <xsl:copy-of select="."/></xsl:result-document>
  428. </xsl:when>
  429. <xsl:otherwise>
  430. <xsl:message>#227.1 probably exists file:<xsl:value-of select="$wfs_output.dita"/>; - bypassing </xsl:message>
  431. </xsl:otherwise>
  432. </xsl:choose>-->
  433. </xsl:when>
  434. <xsl:otherwise>
  435. <error>
  436. <xsl:attribute name="xpath" select="$xpath"/>
  437. <xsl:attribute name="xpath_dita" select="$xpath_dita"/>
  438. <xsl:attribute name="xpath_value" select="$xpath_value"/>
  439. <xsl:attribute name="xpath_value_dita" select="$xpath_value_dita"/>
  440. <xsl:attribute name="typeName" select="$typeName"/>
  441. <xsl:attribute name="typeName_dita" select="$typeName_dita"/>
  442. <xsl:attribute name="featureID_name" select="$featureID_name"/>
  443. <xsl:attribute name="featureID_name_dita" select="$featureID_name_dita"/>
  444. <echo message="OUTPUT__START"/>
  445. <echo>
  446. Current template doesnt fit the requested data - TODO search for another template!
  447. </echo>
  448. <echo message="OUTPUT__END"/>
  449. </error>
  450. </xsl:otherwise>
  451. </xsl:choose>
  452. </xsl:template>
  453. <!-- second step from local ant leaf -->
  454. <xsl:template match="RelatedFeature" mode="after_first_ant_assing_vars">
  455. <xsl:param name="loop_xpath" select="$loop_xpath"/>
  456. <RelatedFeatureRoot>
  457. <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>
  458. <!-- first assign xpath to features from -->
  459. <xsl:variable name="wfs_output_nodes" select="doc($wfs_output)"/>
  460. <xsl:variable name="current_RelatedFeature" select="*"/>
  461. <xsl:variable name="xml_id" select="@xml_id"/>
  462. <!--<input_obj_with_xpath_debug>
  463. <xsl:copy-of select="$wfs_output_nodes"/>
  464. </input_obj_with_xpath_debug>-->
  465. <xsl:message>#354 count($wfs_output_nodes//gml:featureMember) <xsl:value-of select="count($wfs_output_nodes//gml:featureMember)"/></xsl:message>
  466. <!-- tutaj jest blad przetwarzania ze wrzuca po rekordzie do kolumny - trzeba przetworzyc dla kazdego feature member -->
  467. <xsl:for-each select="$wfs_output_nodes//gml:featureMember">
  468. <xsl:variable name="input_obj_with_xpath">
  469. <xsl:apply-templates mode="after_first_ant_assing_xpath" select="node()/*"/> <!-- zeby nie wstawial do xpath nazwy feature - IN7_DZIENNIK_KORESP/ID itp -->
  470. </xsl:variable>
  471. <!--<input_obj_with_xpath_debug>
  472. <xsl:attribute name="xpath" select="$xpath"/>
  473. <!-\-<xsl:attribute name="xpath_dita" select="$xpath_dita"/>-\->
  474. <xsl:attribute name="xpath_value" select="$xpath_value"/>
  475. <!-\-<xsl:attribute name="xpath_value_dita" select="$xpath_value_dita"/>-\->
  476. <xsl:attribute name="typeName" select="$typeName"/>
  477. <!-\-<xsl:attribute name="typeName_dita" select="$typeName_dita"/>-\->
  478. <!-\-<xsl:attribute name="featureID_name" select="$featureID_name"/>-\->
  479. <!-\-<xsl:attribute name="featureID_name_dita" select="$featureID_name_dita"/>-\->
  480. <xsl:copy-of select="$input_obj_with_xpath"/>
  481. </input_obj_with_xpath_debug>-->
  482. <!--<input_node_debug>
  483. <xsl:copy-of select="."/>
  484. </input_node_debug>-->
  485. <xsl:apply-templates mode="after_first_ant_assing_vars_childs" select="$current_RelatedFeature">
  486. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  487. <xsl:with-param name="xml_id_parent" select="$xml_id"/>
  488. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  489. <xsl:with-param name="feature_pos" select="position()"/><!-- wiecej features z relacji dokladamy pozycje -->
  490. </xsl:apply-templates>
  491. </xsl:for-each>
  492. </RelatedFeatureRoot>
  493. </xsl:template>
  494. <xsl:template match="wfs:FeatureCollection|gml:featureMember" mode="after_first_ant_assing_xpath">
  495. <xsl:apply-templates mode="after_first_ant_assing_xpath"/>
  496. </xsl:template>
  497. <xsl:template mode="after_first_ant_assing_xpath" match="*">
  498. <xsl:param name="curr_xpath"/>
  499. <xsl:param name="loop_xpath" select="$loop_xpath"/>
  500. <xsl:choose>
  501. <xsl:when test="name()=$typeName">
  502. <xsl:apply-templates mode="after_first_ant_assing_xpath">
  503. <xsl:with-param name="curr_xpath" select="$curr_xpath"/>
  504. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  505. </xsl:apply-templates>
  506. </xsl:when>
  507. <xsl:otherwise>
  508. <xsl:variable name="curr_xpath_tmpl">
  509. <xsl:choose>
  510. <xsl:when test="$curr_xpath=''">
  511. <xsl:value-of select="local-name()"/> <!-- bylo local-name() - trzeba dorzucic xpath przechodzacy aby budowal sie w kwestii -->
  512. </xsl:when>
  513. <xsl:otherwise>
  514. <xsl:value-of select="concat($curr_xpath,'/',local-name())"/>
  515. </xsl:otherwise>
  516. </xsl:choose>
  517. </xsl:variable>
  518. <!--<xsl:variable name="curr_xpath_tmpl" select="'asdf'"/>-->
  519. <xsl:element name="{name()}">
  520. <xsl:attribute name="xpath" select="$curr_xpath_tmpl"/>
  521. <xsl:for-each select="@*">
  522. <xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute>
  523. </xsl:for-each>
  524. <xsl:value-of select="text()"/>
  525. <xsl:apply-templates mode="after_first_ant_assing_xpath">
  526. <xsl:with-param name="curr_xpath" select="$curr_xpath_tmpl"/>
  527. </xsl:apply-templates>
  528. </xsl:element>
  529. </xsl:otherwise>
  530. </xsl:choose>
  531. </xsl:template>
  532. <xsl:template match="text()" mode="after_first_ant_assing_xpath"/>
  533. <!-- przetwarzanie kolejne w celu podstawienia wartosci i wystawienia build dla kolejnych wezlow - problem z obsluga rownorzednie zagniezdzonych wezlow poprzez inne wezly -->
  534. <xsl:template match="*" mode="after_first_ant_assing_vars_childs">
  535. <xsl:param name="xml_id_parent" required="yes"/>
  536. <xsl:param name="loop_xpath" required="yes"/>
  537. <xsl:param name="input_obj_with_xpath" required="yes"/>
  538. <xsl:param name="feature_pos" required="yes"/>
  539. <xsl:for-each select=".">
  540. <xsl:choose>
  541. <!--<xsl:when test="node()='topic'">asdad</xsl:when>-->
  542. <!--<xsl:when test="name()='RelatedFeature'">
  543. <xsl:for-each select="data/apiname[@base='PROCES_INCLUDE']">
  544. <xsl:apply-templates mode="PROCES_INCLUDE">
  545. <xsl:with-param name="ID_PROCES" select="text()"/>
  546. </xsl:apply-templates>
  547. </xsl:for-each>
  548. </xsl:when>-->
  549. <!--<xsl:when test="name()='data-about'">
  550. <xsl:for-each select="data/apiname[@base='PROCES_INCLUDE']">
  551. <xsl:apply-templates mode="PROCES_INCLUDE">
  552. <xsl:with-param name="ID_PROCES" select="text()"/>
  553. </xsl:apply-templates>
  554. </xsl:for-each>
  555. </xsl:when>-->
  556. <xsl:when test="1=2"/>
  557. <xsl:otherwise>
  558. <xsl:element name="{name()}">
  559. <!--<xsl:copy-of select="namespace::node()"/>-->
  560. <xsl:for-each select="@*">
  561. <xsl:choose>
  562. <xsl:when test="name()='xpath'">
  563. <!--<xsl:attribute name="xpath_parsed" select="."/>-->
  564. <!--1:<xsl:value-of select="$parent_obj//node()[@system_cache__appinfo:xpath=$xpath]/text()"/>-->
  565. <!--<xsl:value-of select="$parent_obj//node()[local-name()=$xpath]/text()"/>-->
  566. <!--V:<xsl:value-of select="$xpath"/>-->
  567. </xsl:when>
  568. <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
  569. </xsl:choose>
  570. </xsl:for-each>
  571. <xsl:choose>
  572. <xsl:when test="@xpath">
  573. <!--<xsl:variable name="escaped_html_to_xml">
  574. <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
  575. <xsl:with-param name="html" select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]/text()"/>
  576. </xsl:call-template>
  577. </xsl:variable>-->
  578. <xsl:variable name="enter_to_ph">
  579. <xsl:apply-templates mode="enter_to_ph" select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]">
  580. <xsl:with-param name="count" select="count($input_obj_with_xpath/node()[local-name()=current()/@xpath])"/>
  581. <xsl:with-param name="element" select="name()"/>
  582. </xsl:apply-templates>
  583. </xsl:variable>
  584. <xsl:copy-of select="$enter_to_ph"/>
  585. </xsl:when>
  586. </xsl:choose>
  587. <xsl:value-of select="text()"/>
  588. <xsl:apply-templates mode="after_first_ant_assing_vars_childs">
  589. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  590. <xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>
  591. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  592. <xsl:with-param name="feature_pos" select="$feature_pos"/>
  593. </xsl:apply-templates>
  594. </xsl:element>
  595. </xsl:otherwise>
  596. </xsl:choose>
  597. </xsl:for-each>
  598. </xsl:template>
  599. <xsl:template match="RelatedFeature" mode="after_first_ant_assing_vars_childs">
  600. <xsl:param name="input_obj_with_xpath" required="yes"/>
  601. <xsl:param name="xml_id_parent" required="yes"/>
  602. <xsl:param name="loop_xpath" select="$loop_xpath"/>
  603. <xsl:param name="feature_pos" required="yes"/>
  604. <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>
  605. <!-- jest okazja do zrobienia bilda aby sciagnal rzeczy nizej -->
  606. <xsl:variable name="featureID_name" select="substring-after(@typeName,':')"/>
  607. <xsl:variable name="xml_id" select="@xml_id"/>
  608. <xsl:variable name="loop_xpath" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>
  609. <!--<xsl:variable name="loop_xpath_save" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>--> <!-- tutaj zapisal sie build z wezla z parent -->
  610. <!--<debug_358_RelatedFeature>
  611. <xsl:copy-of select="$input_obj_with_xpath"/>
  612. </debug_358_RelatedFeature>-->
  613. <!--<xsl:variable name="feature_pos">
  614. <xsl:choose>
  615. <xsl:when test="$feature_pos=1"/>
  616. <xsl:otherwise><xsl:value-of select="$feature_pos"/></xsl:otherwise>
  617. </xsl:choose>
  618. </xsl:variable>-->
  619. <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>
  620. <xsl:result-document href="{$uuid}.build_{$loop_xpath}.{$feature_pos}.xml">
  621. <xsl:apply-templates select=".">
  622. <xsl:with-param name="typeName" select="@typeName"/>
  623. <xsl:with-param name="xpath" select="@xpath"/>
  624. <xsl:with-param name="xpath_value" select="@xpath_value"/>
  625. <!--<xsl:with-param name="loop_xpath_save" select="$loop_xpath"/>-->
  626. <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
  627. <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
  628. <xsl:with-param name="wfs_output" select="concat($uuid,'.',$loop_xpath)" />
  629. <xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>
  630. <xsl:with-param name="feature_pos" select="$feature_pos"/>
  631. <!--<xsl:with-param name="wfs_output.xml" />-->
  632. </xsl:apply-templates>
  633. </xsl:result-document>
  634. <xsl:element name="RelatedFeature">
  635. <xsl:copy-of select="@*"/>
  636. <xsl:attribute name="featureID_name" select="$featureID_name"/>
  637. <xsl:attribute name="loop_xpath" select="$loop_xpath"/>
  638. </xsl:element>
  639. </xsl:template>
  640. <xsl:template match="text()" mode="after_first_ant_assing_vars_childs"/>
  641. <xsl:template match="comment()" mode="after_first_ant_assing_vars_childs"/>
  642. <!-- pozbieranie do kupy wszystkich xmli i zlozenie dity -->
  643. <xsl:template match="*" mode="enter_to_ph">
  644. <xsl:param name="count"/>
  645. <xsl:param name="element"/>
  646. <xsl:variable name="current" select="."/>
  647. <xsl:variable name="surround_with">
  648. <xsl:choose>
  649. <xsl:when test="$element='p'"><xsl:value-of select="'codeblock'"/></xsl:when>
  650. <xsl:when test="$element='bodydiv'"><xsl:value-of select="'p'"/></xsl:when>
  651. <xsl:otherwise><xsl:value-of select="'codeblock'"/></xsl:otherwise>
  652. </xsl:choose>
  653. </xsl:variable>
  654. <xsl:choose>
  655. <xsl:when test=" contains( text(),'&#13;')">
  656. <xsl:for-each select="tokenize( text(),'&#13;')">
  657. <xsl:element name="{$surround_with}"><!-- to jest przetwarzane jak jest tekst lamany -->
  658. <xsl:value-of select="."/>
  659. </xsl:element>
  660. </xsl:for-each>
  661. </xsl:when>
  662. <xsl:otherwise>
  663. <xsl:choose>
  664. <xsl:when test="$count &gt;1">
  665. <codeblock>
  666. <!--<xsl:attribute name="DDxpath" select="@xpath"/>-->
  667. <!--DN(<xsl:value-of select="$element"/>)-->
  668. <!--count:<xsl:value-of select="$count"/>-->
  669. <xsl:copy-of select=" text()"/>
  670. </codeblock>
  671. </xsl:when>
  672. <xsl:otherwise>
  673. <xsl:apply-templates mode="enter_to_ph_text">
  674. <xsl:with-param name="element" select="$element"/>
  675. </xsl:apply-templates>
  676. <!--<xsl:copy-of select=" text()"/>-->
  677. </xsl:otherwise>
  678. </xsl:choose>
  679. </xsl:otherwise>
  680. </xsl:choose>
  681. </xsl:template>
  682. <!-- dodanie enterow dla tabel w ktorych wyrazy sa dluzsze niz 10 znakow -->
  683. <xsl:template match="text()" mode="enter_to_ph_text">
  684. <xsl:param name="element" required="yes"/>
  685. <xsl:choose>
  686. <xsl:when test="$element='entry'">
  687. <xsl:for-each select="tokenize(.,' ')">
  688. <xsl:value-of select="' '"/>
  689. <xsl:variable name="phrase" select="."/>
  690. <xsl:for-each select="1 to string-length(.)">
  691. <xsl:if test="position() mod 12 = 0"><xsl:value-of select="' -'"/></xsl:if>
  692. <xsl:value-of select="substring($phrase,position(),1)"/>
  693. </xsl:for-each>
  694. </xsl:for-each>
  695. </xsl:when>
  696. <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
  697. </xsl:choose>
  698. </xsl:template>
  699. </xsl:stylesheet>