procesy5_to_bpmn.xsl 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. exclude-result-prefixes="xs"
  5. version="2.0"
  6. xmlns:p5tobpmn="http://biuro.biall-net.pl/xmlschema_procesy5/objects/procesy5_to_bpmn.xsl" >
  7. <xsl:output omit-xml-declaration="no" indent="yes" method="xml" encoding="UTF-8" version="1.0"/>
  8. <!--
  9. <xsl:key name="proc_id" match="data/items/item" use="ID"/>
  10. <xsl:key name="proc_pid" match="data/items/item" use="PARENT_ID"/>
  11. <xsl:key name="PROCES_INIT" match="data/items/item" use="TYPE"/>
  12. -->
  13. <!-- <xsl:namespace-alias stylesheet-prefix="" result-prefix=""/> -->
  14. <!-- funkcja do znalezienia dziecka procesu, uzywana rekursywnie -->
  15. <!-- <xsl:function name="p5tobpmn:find_child_proces">
  16. <xsl:param name="proces_list"/>
  17. <xsl:param name="proces_id"/>
  18. <xsl:variable name="myArray">
  19. <xsl:for-each select="$proces_list">
  20. <item><xsl:value-of select="." /></item>
  21. </xsl:for-each>
  22. </xsl:variable>
  23. <xsl:value-of select="$myArray"/>
  24. </xsl:function>
  25. -->
  26. <!-- template do znalezienia dziecka procesu, test -->
  27. <xsl:template name="find_child_proces">
  28. <xsl:param name="proces_id" />
  29. <xsl:param name="count"/>
  30. <xsl:choose>
  31. <xsl:when test="$count > 0">
  32. <xsl:for-each select="document('CRM_PROCES.xml')/data/items/item/ID[../TYPE='PROCES' and ../A_STATUS!='DELETED' and ../PARENT_ID=$proces_id]">
  33. <!--<xsl:text>&#xa;</xsl:text>-->
  34. <xsl:element name="childs">
  35. <xsl:element name="child">
  36. <xsl:value-of select="."/>
  37. </xsl:element>
  38. <xsl:variable name="proces_id" select="."/>
  39. <xsl:call-template name="Pools">
  40. <xsl:with-param name="proces_id" select="."/>
  41. </xsl:call-template>
  42. </xsl:element>
  43. <xsl:call-template name="find_child_proces">
  44. <xsl:with-param name="proces_id" select="."/>
  45. <xsl:with-param name="count" select="$count - 1"/>
  46. </xsl:call-template>
  47. </xsl:for-each>
  48. </xsl:when>
  49. <xsl:otherwise>
  50. Error in loop!!!(<xsl:value-of select="$count"/>)
  51. </xsl:otherwise>
  52. </xsl:choose>
  53. </xsl:template>
  54. <!-- <xsl:template match="/">
  55. <xsl:call-template name="procesy"/>
  56. </xsl:template>
  57. -->
  58. <!-- Template do zadeklarowania basenow - czyli stanowisk z procesow -->
  59. <xsl:template name="Pools">
  60. <xsl:param name="proces_id" />
  61. <xsl:for-each select="document('CRM_WSKAZNIK.xml')/data/items/item[A_STATUS!='DELETED' and ID_PROCES=$proces_id]">
  62. <xsl:element name="ID_ZASOB">
  63. <xsl:value-of select="ID_ZASOB"/>
  64. </xsl:element>
  65. <!--
  66. <xsl:call-template name="Stanowiska_name">
  67. <xsl:with-param name="id_zasob" select="ID_ZASOB"/>
  68. </xsl:call-template>
  69. -->
  70. </xsl:for-each>
  71. </xsl:template>
  72. <!-- przyklad <lane id="PO_p342" name="Typowe Stanowisko Obieg Dok"> -->
  73. <!-- <xsl:template name="Stanowiska_name">
  74. <xsl:param name="id_zasob"/>
  75. <xsl:for-each select="document('CRM_LISTA_ZASOBOW.xml')/data/items/item[A_STATUS!='DELETED' and ID=$id_zasob and TYPE='STANOWISKO']">
  76. <xsl:element name="lane">
  77. <xsl:attribute name="id">
  78. <xsl:value-of select="concat('CRM_LISTA_ZASOBOW_',ID)"/>
  79. </xsl:attribute>
  80. <xsl:attribute name="name">
  81. <xsl:value-of select="DESC"/>
  82. </xsl:attribute>
  83. </xsl:element>
  84. </xsl:for-each>
  85. </xsl:template>
  86. -->
  87. <xsl:template match="/">
  88. <!-- <xsl:variable name="foldername" select="concat(/build/major, /build/minor, string(/build/build + 1), build/release)"/> -->
  89. <!-- <xsl:result-document href="_procesy_gen.xml" method="xml" version="1.0" indent="yes" encoding="UTF-8" omit-xml-declaration="no"> -->
  90. <!--
  91. <xsl:element name="definitions">
  92. <xsl:attribute name="xsd" namespace="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</xsl:attribute>
  93. <xsl:attribute name="xsi" namespace="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</xsl:attribute>
  94. <xsl:attribute name="Name">Procesy import z notacji Procesy5 do BPMN</xsl:attribute>
  95. -->
  96. <!-- xmlns:xsd="http://www.w3.org/2001/XMLSchema" -->
  97. <!-- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" -->
  98. <!-- Name="Uzyskanie zgody na swiadczenie uslug" xmlns="http://www.wfmc.org/2009/XPDL2.2" -->
  99. <!-- Deklarujemy arraya ze wszystkimi procesami ID oraz PARENT_ID -->
  100. <!--
  101. <xsl:variable name="dzieci_procesow">
  102. <xsl:for-each select="/data/items/item/ID[../A_STATUS!='DELETED' and ../PARENT_ID='994']">
  103. <item><xsl:value-of select="."/></item>
  104. </xsl:for-each>
  105. </xsl:variable>
  106. -->
  107. <!-- <xsl:value-of select="/data/items/item/ID[../A_STATUS!='DELETED' and ../PARENT_ID='994']"/>
  108. </xsl:variable>
  109. -->
  110. <!--
  111. <xsl:variable name="dzieci_procesow1" as="element()*">
  112. <Item>10</Item>
  113. <Item>3</Item>
  114. </xsl:variable>
  115. -->
  116. <!--
  117. <collaboration id="COLLABORATION-P_p22">
  118. <participant id="PO_p341" processRef="PROCESS-PO_p341" name="Firma">
  119. <participantMultiplicity maximum="1" minimum="0"/>
  120. </participant></collaboration>
  121. <process id="PROCESS-PO_p341" isClosed="false" isExecutable="true" processType="None">
  122. <laneSet id="LANESET-PO_p341">
  123. <lane id="PO_p342" name="Typowe Stanowisko Obieg Dok">
  124. <flowNodeRef>PO_p345</flowNodeRef><flowNodeRef>PO_p355</flowNodeRef>
  125. <flowNodeRef>PO_p343</flowNodeRef></lane>
  126. <lane id="PO_p366" name="serwis"><flowNodeRef>PO_p368</flowNodeRef></lane>
  127. </laneSet>
  128. <startEvent id="PO_p343" name="1 - przyjecie pisma"><outgoing>PO_p344</outgoing>
  129. </startEvent>
  130. -->
  131. <!--
  132. <xsl:element name="collaboration">
  133. <xsl:attribute name="id"><xsl:value-of>COLLABORATION-P_p22</xsl:value-of></xsl:attribute>
  134. <xsl:element name="participant">
  135. <xsl:attribute name="id"><xsl:value-of>PO_p341</xsl:value-of></xsl:attribute>
  136. <xsl:attribute name="processRef"><xsl:value-of>PROCESS-PO_p341</xsl:value-of></xsl:attribute>
  137. </xsl:element>
  138. </xsl:element>
  139. -->
  140. <xsl:element name="root">
  141. <xsl:for-each select="/data/items/item[TYPE='PROCES_INIT' and A_STATUS!='DELETED']">
  142. <!-- <xsl:sort select="idx_PROCES_INIT_ID"/> -->
  143. <xsl:if test="TYPE = 'PROCES_INIT'">
  144. <!-- znajdujemy proces , teraz trzeba pozbierac kroki -->
  145. <!-- <xsl:variable name="dzieci" select="p5tobpmn:find_child_proces($dzieci_procesow,ID)"/> -->
  146. <!-- Najpierw deklarujemy basen(y) do danego procesu -->
  147. <!-- @temp off at 2014-12
  148. <xsl:call-template name="Pools">
  149. <xsl:with-param name="proces_id" select="ID"/>
  150. </xsl:call-template>
  151. <xsl:text>&#xa;</xsl:text>
  152. -->
  153. <xsl:element name="Proces">
  154. <xsl:element name="Proces_id">
  155. <xsl:value-of select="ID"/>
  156. </xsl:element>
  157. <xsl:element name="pools">
  158. <xsl:element name="child">
  159. <xsl:value-of select="ID"/>
  160. </xsl:element>
  161. <xsl:call-template name="Pools">
  162. <xsl:with-param name="proces_id" select="ID"/>
  163. </xsl:call-template>
  164. </xsl:element>
  165. <xsl:element name="childs">
  166. <xsl:element name="child">
  167. <xsl:value-of select="ID"/>
  168. </xsl:element>
  169. <xsl:call-template name="Pools">
  170. <xsl:with-param name="proces_id" select="ID"/>
  171. </xsl:call-template>
  172. </xsl:element>
  173. <xsl:call-template name="find_child_proces">
  174. <xsl:with-param name="proces_id" select="ID"/>
  175. <xsl:with-param name="count" select="50"/>
  176. </xsl:call-template>
  177. </xsl:element>
  178. </xsl:if>
  179. </xsl:for-each>
  180. </xsl:element>
  181. <!-- </xsl:element> -->
  182. <!-- </xsl:result-document> -->
  183. <!-- <xsl:call-template name="_procesy_gen"/> -->
  184. </xsl:template>
  185. <!-- Template do generowania z listy procesow listy stanowisk -->
  186. <xsl:template name="_procesy_gen">
  187. <!-- <xsl:result-document href="_zasoby_to_procesy_gen.xml" method="xml"> -->
  188. <xsl:for-each select="document('_procesy_gen.xml')/Proces_id">
  189. <xsl:element name="Proces_id" >
  190. <xsl:value-of select="child"/>
  191. </xsl:element>
  192. </xsl:for-each>
  193. <!-- </xsl:result-document> -->
  194. </xsl:template>
  195. </xsl:stylesheet>