p5up5b.xsl 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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:p5up5b="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/upgrade_procesy5_bocian.xsd"
  5. xmlns:wsbpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
  6. xmlns:p5suis="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/system_ui_info_speech/system_ui_info_speech.xsd"
  7. xmlns:p5dg="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/documentation_generator/documentation_generator.xsd"
  8. xmlns:p5ant="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache.public/ant/ant.xsd"
  9. exclude-result-prefixes="xs"
  10. version="2.0">
  11. <xsl:output indent="yes"/>
  12. <xsl:strip-space elements="*"/>
  13. <xsl:include href="p5dg.p5ant.include.structure.ant.build.target.mysqldump.xsl"/>
  14. <xsl:include href="p5dg.p5ant.include.structure.ant.build.target.php.xsl"/>
  15. <xsl:include href="p5dg.p5ant.include.structure.ant.build.target.sql.xsl"/>
  16. <xsl:param name="local.prefix" select="'p5up5b.local'"/>
  17. <xsl:param name="remote.prefix" select="'p5up5b.remote'"/>
  18. <xsl:param name="controller.prefix" select="'p5up5b.controller'"/>
  19. <xsl:variable name="p5up5b.properties.match" select="concat('(',$local.prefix,'\.[0-9]*\..*)|(',$remote.prefix,'\.[0-9]*\..*)|(',$controller.prefix,'\.[0-9]*\..*)')"/>
  20. <xsl:template match="properties" mode="wsbpel:p5up5b.ws-bpel_executable.xml.sort_tasks.xml">
  21. <wsbpel:p5up5b.ws-bpel_executable.xml.sort_tasks.xml>
  22. <xsl:apply-templates mode="#current"></xsl:apply-templates>
  23. </wsbpel:p5up5b.ws-bpel_executable.xml.sort_tasks.xml>
  24. </xsl:template>
  25. <xsl:template match="property" mode="wsbpel:p5up5b.ws-bpel_executable.xml.sort_tasks.xml">
  26. <xsl:choose>
  27. <xsl:when test=" matches(@name,$p5up5b.properties.match)">
  28. <xsl:element name="target">
  29. <xsl:attribute name="id" select="generate-id()"/>
  30. <xsl:copy-of select="@*"/>
  31. <xsl:choose>
  32. <xsl:when test=" substring-after(@name,$local.prefix)">
  33. <xsl:attribute name="p5up5b:task_side" select="'local'"/>
  34. <xsl:attribute name="p5up5b:prefix" select="$local.prefix"/>
  35. <xsl:attribute name="p5up5b:task_name" select="p5up5b:task_name(@name,$local.prefix)"/>
  36. <xsl:attribute name="p5up5b:task_name.param" select="p5up5b:task_name.param(@name,$local.prefix)"/>
  37. <xsl:attribute name="p5up5b:task_name.param.attr" select="p5up5b:task_name.param.attr(@name,$local.prefix)"/>
  38. <xsl:attribute name="p5up5b:pos" select="p5up5b:task_number(@name,$local.prefix)"/>
  39. <xsl:attribute name="p5up5b:task_type" select="p5up5b:task_type(@name,$local.prefix)"/>
  40. <xsl:attribute name="p5up5b:task_type.pos" select="p5up5b:task_type.pos(@name,$local.prefix)"/>
  41. </xsl:when>
  42. <xsl:when test=" substring-after(@name,$remote.prefix)">
  43. <xsl:attribute name="p5up5b:task_side" select="'remote'"/>
  44. <xsl:attribute name="p5up5b:prefix" select="$remote.prefix"/>
  45. <xsl:attribute name="p5up5b:task_name" select="p5up5b:task_name(@name,$remote.prefix)"/>
  46. <xsl:attribute name="p5up5b:task_name.param" select="p5up5b:task_name.param(@name,$remote.prefix)"/>
  47. <xsl:attribute name="p5up5b:task_name.param.attr" select="p5up5b:task_name.param.attr(@name,$remote.prefix)"/>
  48. <xsl:attribute name="p5up5b:pos" select="p5up5b:task_number(@name,$remote.prefix)"/>
  49. <xsl:attribute name="p5up5b:task_type" select="p5up5b:task_type(@name,$remote.prefix)"/>
  50. <xsl:attribute name="p5up5b:task_type.pos" select="p5up5b:task_type.pos(@name,$remote.prefix)"/>
  51. </xsl:when>
  52. <xsl:when test=" substring-after(@name,$controller.prefix)">
  53. <xsl:attribute name="p5up5b:task_side" select="'controller'"/>
  54. <xsl:attribute name="p5up5b:prefix" select="$controller.prefix"/>
  55. <xsl:attribute name="p5up5b:task_name" select="p5up5b:task_name(@name,$controller.prefix)"/>
  56. <xsl:attribute name="p5up5b:task_name.param" select="p5up5b:task_name.param(@name,$controller.prefix)"/>
  57. <xsl:attribute name="p5up5b:task_name.param.attr" select="p5up5b:task_name.param.attr(@name,$controller.prefix)"/>
  58. <xsl:attribute name="p5up5b:pos" select="p5up5b:task_number(@name,$controller.prefix)"/>
  59. <xsl:attribute name="p5up5b:task_type" select="p5up5b:task_type(@name,$controller.prefix)"/>
  60. <xsl:attribute name="p5up5b:task_type.pos" select="p5up5b:task_type.pos(@name,$controller.prefix)"/>
  61. </xsl:when>
  62. </xsl:choose>
  63. <!--<xsl:for-each select=" tokenize( @name , '\.')">
  64. <xsl:attribute name="pos_{position()}" select="."/>
  65. </xsl:for-each>-->
  66. </xsl:element>
  67. </xsl:when>
  68. <xsl:otherwise>
  69. <xsl:copy-of select="."/>
  70. </xsl:otherwise>
  71. </xsl:choose>
  72. </xsl:template>
  73. <xsl:function name="p5up5b:task_number">
  74. <xsl:param name="p5up5b:property.name"/>
  75. <xsl:param name="p5up5b:property.prefix"/>
  76. <xsl:value-of select="tokenize(substring-after($p5up5b:property.name,$p5up5b:property.prefix),'\.')[2]"/>
  77. </xsl:function>
  78. <xsl:function name="p5up5b:task_type">
  79. <xsl:param name="p5up5b:property.name"/>
  80. <xsl:param name="p5up5b:property.prefix"/>
  81. <xsl:value-of select="tokenize(substring-after($p5up5b:property.name,$p5up5b:property.prefix),'\.')[3]"/>
  82. </xsl:function>
  83. <xsl:function name="p5up5b:task_type.pos">
  84. <xsl:param name="p5up5b:property.name"/>
  85. <xsl:param name="p5up5b:property.prefix"/>
  86. <xsl:value-of select="tokenize(substring-after($p5up5b:property.name,$p5up5b:property.prefix),'\.')[4]"/>
  87. </xsl:function>
  88. <xsl:function name="p5up5b:task_name">
  89. <xsl:param name="p5up5b:property.name"/>
  90. <xsl:param name="p5up5b:property.prefix"/>
  91. <xsl:value-of select="$p5up5b:property.prefix"/><xsl:text>.</xsl:text>
  92. <xsl:value-of select="tokenize(substring-after($p5up5b:property.name,$p5up5b:property.prefix),'\.')[2]"/>
  93. <xsl:text>.</xsl:text>
  94. <xsl:value-of select="tokenize(substring-after($p5up5b:property.name,$p5up5b:property.prefix),'\.')[3]"/>
  95. <xsl:text>.</xsl:text>
  96. <xsl:value-of select="tokenize(substring-after($p5up5b:property.name,$p5up5b:property.prefix),'\.')[4]"/>
  97. </xsl:function>
  98. <xsl:function name="p5up5b:task_name.param">
  99. <xsl:param name="p5up5b:property.name"/>
  100. <xsl:param name="p5up5b:property.prefix"/>
  101. <xsl:value-of select="tokenize(substring-after($p5up5b:property.name,$p5up5b:property.prefix),'\.')[5]"/>
  102. </xsl:function>
  103. <xsl:function name="p5up5b:task_name.param.attr">
  104. <xsl:param name="p5up5b:property.name"/>
  105. <xsl:param name="p5up5b:property.prefix"/>
  106. <xsl:value-of select="tokenize(substring-after($p5up5b:property.name,$p5up5b:property.prefix),'\.')[6]"/>
  107. </xsl:function>
  108. <xsl:template match="wsbpel:p5up5b.ws-bpel_executable.xml.sort_tasks.xml" mode="wsbpel:p5up5b.ws-bpel_executable.xml">
  109. <wsbpel:p5up5b.ws-bpel_executable.xml>
  110. <xsl:for-each-group select="*" group-by="@p5up5b:task_name">
  111. <xsl:apply-templates mode="p5dg:p5ant.include.structure.ant.build.target" select=".">
  112. <xsl:sort select="@p5up5b:pos"/>
  113. <xsl:sort select="@p5up5b:task_type.pos"/>
  114. </xsl:apply-templates>
  115. </xsl:for-each-group>
  116. </wsbpel:p5up5b.ws-bpel_executable.xml>
  117. </xsl:template>
  118. <xsl:template match="@p5up5b:sort|@p5up5b:group" mode="p5up5b:sort"/>
  119. <xsl:template match="@*" mode="p5up5b:sort">
  120. <xsl:copy-of select="."/>
  121. </xsl:template>
  122. <xsl:template mode="p5up5b:sort" match="*">
  123. <xsl:copy copy-namespaces="no">
  124. <xsl:apply-templates mode="#current" select="@*"/>
  125. <xsl:for-each-group select="p5up5b:to_merge_element" group-by="@p5up5b:group">
  126. <xsl:sort select="number(@p5up5b:sort)"/>
  127. <xsl:variable name="current.node" select="current-group()/*"/>
  128. <xsl:for-each-group select="." group-by="@p5up5b:sort">
  129. <xsl:sort select="number(@p5up5b:sort)"/>
  130. <xsl:for-each select="*">
  131. <xsl:sort select="number(@p5up5b:sort)"/>
  132. <xsl:copy copy-namespaces="no">
  133. <xsl:variable name="attr.name">
  134. <xsl:for-each select="@*">
  135. <xsl:if test="not(contains(name(),'p5up5b:'))"><xsl:value-of select="name()"/></xsl:if>
  136. </xsl:for-each>
  137. </xsl:variable> <!-- [ not(contains(name(),'p5up5b:'))] -->
  138. <xsl:attribute name="{$attr.name}">
  139. <xsl:for-each select="$current.node/@*">
  140. <xsl:sort select="number(../../@p5up5b:sort)"/>
  141. <xsl:choose>
  142. <xsl:when test="not(contains(name(),'p5up5b:'))">
  143. <xsl:value-of select="."/>
  144. </xsl:when>
  145. </xsl:choose>
  146. </xsl:for-each>
  147. </xsl:attribute>
  148. </xsl:copy>
  149. </xsl:for-each>
  150. </xsl:for-each-group>
  151. </xsl:for-each-group>
  152. <xsl:apply-templates mode="#current">
  153. <xsl:sort select="number(@p5up5b:sort)"/>
  154. </xsl:apply-templates>
  155. </xsl:copy>
  156. </xsl:template>
  157. <xsl:template mode="p5up5b:sort" match="p5up5b:text">
  158. <xsl:value-of select="text()"/>
  159. </xsl:template>
  160. <xsl:template mode="p5up5b:sort" match="p5up5b:to_merge_element"/>
  161. <xsl:function name="p5up5b:getproperty">
  162. <xsl:param name="root.node"/>
  163. <xsl:param name="p5up5b:prefix"/>
  164. <xsl:param name="p5up5b:searched_name"/>
  165. <xsl:variable name="matches" select="concat($p5up5b:prefix,'\..*',$p5up5b:searched_name)"/>
  166. <xsl:value-of select="$root.node//property[matches(@name, $matches)]/@value"/>
  167. </xsl:function>
  168. <xsl:template match="target" mode="wsbpel:p5up5b.ws-bpel_executable.xml">
  169. <xsl:comment>#91 unknown type task <xsl:value-of select="@p5up5b:task_type"/></xsl:comment>
  170. <xsl:message>#91 unknown type task <xsl:value-of select="@p5up5b:task_type"/></xsl:message>
  171. </xsl:template>
  172. <xsl:template match="property" mode="wsbpel:p5up5b.ws-bpel_executable.xml">
  173. <xsl:copy-of select="."/>
  174. </xsl:template>
  175. </xsl:stylesheet>