build_recurse_ant.xsl 56 KB

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