UpgradeActionLog.xsl 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: fmmd
  5. (C) Copyright IBM Corp. 2003, 2010
  6. US Government Users Restricted Rights - Use, duplication or disclosure
  7. restricted by GSA ADP Schedule Contract with IBM Corp.
  8. -->
  9. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  10. <xsl:template match="*">
  11. <xsl:copy>
  12. <xsl:copy-of select="@*"/>
  13. <xsl:apply-templates/>
  14. </xsl:copy>
  15. </xsl:template>
  16. <xsl:template match="action">
  17. <xsl:if test="not(@type='Create' and inputparams/param[@seq='1']/value='14' and inputparams/param[@seq='2']/value='[].[parameterMaps]' )">
  18. <xsl:copy>
  19. <xsl:attribute name="seq"><xsl:value-of select="@seq"/></xsl:attribute>
  20. <xsl:attribute name="type"><xsl:choose><xsl:when test="@type='AddLanguage' ">AddLocale</xsl:when><xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise></xsl:choose></xsl:attribute>
  21. <xsl:variable name="action_type" select="@type"/>
  22. <xsl:for-each select="*">
  23. <xsl:choose>
  24. <xsl:when test="self::inputparams">
  25. <xsl:copy>
  26. <xsl:choose>
  27. <xsl:when test="$action_type='AddLocale' or $action_type='AddLanguage'">
  28. <param seq="1" type="stringCollection">
  29. <value>
  30. <xsl:value-of select="param[@seq='1']/value"/>
  31. </value>
  32. </param>
  33. <xsl:apply-templates select="param[@seq != '1']"/>
  34. </xsl:when>
  35. <xsl:when test="$action_type='CreateShortcut' or $action_type='LinkModel' or $action_type='ModelImport' ">
  36. <xsl:apply-templates select="*"/>
  37. <param seq="{count(param)+1}" type="integer">
  38. <value>1</value>
  39. </param>
  40. </xsl:when>
  41. <xsl:when test="$action_type='DBImport' ">
  42. <xsl:apply-templates select="param[@seq='1']"/>
  43. <param seq="2" type="{param[@seq='2']/@type}">
  44. <xsl:variable name="newValue">
  45. <xsl:call-template name="substring-replace">
  46. <xsl:with-param name="string">
  47. <xsl:apply-templates select="param[@seq='2']/value"/>
  48. </xsl:with-param>
  49. <xsl:with-param name="search">
  50. <xsl:text disable-output-escaping="yes">&lt;item Name="Procedures" Type="procedures" Value="true"/&gt;</xsl:text>
  51. </xsl:with-param>
  52. <xsl:with-param name="replace">
  53. <xsl:text disable-output-escaping="yes">&lt;item Name="Procedures" Type="procedures" Value="true"/&gt;&lt;item Name="Functions" Type="functions" Value="true"/&gt;</xsl:text>
  54. </xsl:with-param>
  55. </xsl:call-template>
  56. </xsl:variable>
  57. <value>
  58. <!--xsl:copy-of select="$myValue"/-->
  59. <xsl:value-of select="$newValue" disable-output-escaping="yes"/>
  60. </value>
  61. </param>
  62. <param seq="3" type="integer">
  63. <value>0</value>
  64. </param>
  65. <param seq="4" type="integer">
  66. <value>1</value>
  67. </param>
  68. <xsl:for-each select="param[@seq !='1' and @seq!= '2']">
  69. <param seq="{number(@seq)+2}" type="{@type}">
  70. <xsl:apply-templates/>
  71. </param>
  72. </xsl:for-each>
  73. <param seq="9" type="integer">
  74. <value>0</value>
  75. </param>
  76. </xsl:when>
  77. <xsl:when test="$action_type='FindOrCreateDataSource' ">
  78. <param seq="1" type="{param[@seq='5']/@type}">
  79. <xsl:apply-templates select="param[@seq='5']/value"/>
  80. </param>
  81. <xsl:for-each select="param[number(@seq) &lt; 4]">
  82. <param seq="{number(@seq)+1} " type="{@type}">
  83. <xsl:apply-templates/>
  84. </param>
  85. </xsl:for-each>
  86. </xsl:when>
  87. <xsl:when test="$action_type='ImportTranslations' ">
  88. <xsl:for-each select="*">
  89. <xsl:choose>
  90. <xsl:when test="self::param and @seq='3' ">
  91. <param seq="3" type="stringCollection">
  92. <value>
  93. <xsl:value-of select="value"/>
  94. </value>
  95. </param>
  96. </xsl:when>
  97. <xsl:otherwise>
  98. <xsl:copy-of select="."/>
  99. </xsl:otherwise>
  100. </xsl:choose>
  101. </xsl:for-each>
  102. </xsl:when>
  103. <xsl:when test="$action_type='ExportTranslations' ">
  104. <xsl:for-each select="*">
  105. <xsl:choose>
  106. <xsl:when test="self::param and @seq='2' ">
  107. <param seq="2" type="stringCollection">
  108. <value>
  109. <xsl:value-of select="value"/>
  110. </value>
  111. </param>
  112. </xsl:when>
  113. <xsl:otherwise>
  114. <xsl:apply-templates select="."/>
  115. </xsl:otherwise>
  116. </xsl:choose>
  117. </xsl:for-each>
  118. </xsl:when>
  119. <xsl:when test="$action_type='SegmentModel' ">
  120. <xsl:apply-templates select="*"/>
  121. <param seq="{count(param)+1}" type="i18nstring">
  122. <value/>
  123. </param>
  124. </xsl:when>
  125. <xsl:when test="$action_type='TransformRelationship' ">
  126. <xsl:for-each select="param">
  127. <xsl:choose>
  128. <xsl:when test="position() = last() -3">
  129. <param seq="{position()}" type="integer">
  130. <value>0</value>
  131. </param>
  132. <param seq="{position()+1}" type="integer">
  133. <value>1</value>
  134. </param>
  135. <param seq="{position()+2}" type="{@type}">
  136. <xsl:apply-templates/>
  137. </param>
  138. </xsl:when>
  139. <xsl:when test="position() > last() -3">
  140. <param seq="{number(@seq)+2}" type="{@type}">
  141. <xsl:apply-templates/>
  142. </param>
  143. </xsl:when>
  144. <xsl:otherwise>
  145. <xsl:apply-templates select="."/>
  146. </xsl:otherwise>
  147. </xsl:choose>
  148. </xsl:for-each>
  149. </xsl:when>
  150. <xsl:when test="$action_type='ModifyComplex'">
  151. <xsl:apply-templates select="param[@seq='1']"/>
  152. <param seq="2" type="{param[@seq='2']/@type}"/>
  153. <xsl:variable name="newValue">
  154. <xsl:call-template name="substring-replace">
  155. <xsl:with-param name="string">
  156. <xsl:apply-templates select="param[@seq='2']/value"/>
  157. </xsl:with-param>
  158. <xsl:with-param name="search">
  159. <xsl:text disable-output-escaping="no">&lt;functionSetID&gt;</xsl:text>
  160. </xsl:with-param>
  161. <xsl:with-param name="replace">
  162. <xsl:text disable-output-escaping="no">&lt;functionSet&gt;&lt;functionSetID&gt;</xsl:text>
  163. </xsl:with-param>
  164. </xsl:call-template>
  165. </xsl:variable>
  166. <xsl:variable name="newValue2">
  167. <xsl:value-of select="$newValue"/>
  168. <xsl:call-template name="substring-replace">
  169. <xsl:with-param name="string" select="$newValue"/>
  170. <xsl:with-param name="search">
  171. <xsl:text disable-output-escaping="no">&lt;/functionSetID&gt;</xsl:text>
  172. </xsl:with-param>
  173. <xsl:with-param name="replace">
  174. <xsl:text disable-output-escaping="no">&lt;/functionSetID&gt;&lt;/functionSet&gt;</xsl:text>
  175. </xsl:with-param>
  176. </xsl:call-template>
  177. </xsl:variable>
  178. <value>
  179. <xsl:value-of select="$newValue2" disable-output-escaping="no"/>
  180. </value>
  181. </xsl:when>
  182. <xsl:otherwise>
  183. <xsl:apply-templates/>
  184. </xsl:otherwise>
  185. </xsl:choose>
  186. </xsl:copy>
  187. </xsl:when>
  188. <xsl:otherwise>
  189. <xsl:apply-templates select="."/>
  190. </xsl:otherwise>
  191. </xsl:choose>
  192. </xsl:for-each>
  193. </xsl:copy>
  194. </xsl:if>
  195. </xsl:template>
  196. <xsl:template match="value">
  197. <xsl:variable name="paramStr">
  198. <xsl:choose>
  199. <xsl:when test="contains(., '[].[parameterMaps].[governor]') or contains(., '[].[parameterMaps].[env]')">
  200. <xsl:call-template name="substring-replace">
  201. <xsl:with-param name="string">
  202. <xsl:call-template name="substring-replace">
  203. <xsl:with-param name="string" select="."/>
  204. <xsl:with-param name="search" select="'[].[parameterMaps].[governor]' "/>
  205. <xsl:with-param name="replace" select="'[].[parameterMaps].[_governor]' "/>
  206. </xsl:call-template>
  207. </xsl:with-param>
  208. <xsl:with-param name="search" select="'[].[parameterMaps].[env]' "/>
  209. <xsl:with-param name="replace" select="'[].[parameterMaps].[_env]' "/>
  210. </xsl:call-template>
  211. </xsl:when>
  212. <xsl:otherwise>
  213. <xsl:value-of select="."/>
  214. </xsl:otherwise>
  215. </xsl:choose>
  216. </xsl:variable>
  217. <xsl:copy>
  218. <xsl:choose>
  219. <xsl:when test="../@type='cclnode' or ../@type='node' or ../@type='stringCollection' or ../@type='void' ">
  220. <xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>
  221. <xsl:value-of select="$paramStr" disable-output-escaping="yes"/>
  222. <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
  223. </xsl:when>
  224. <xsl:otherwise>
  225. <xsl:value-of select="$paramStr"/>
  226. </xsl:otherwise>
  227. </xsl:choose>
  228. </xsl:copy>
  229. </xsl:template>
  230. <xsl:template name="substring-replace">
  231. <xsl:param name="string"/>
  232. <xsl:param name="search"/>
  233. <xsl:param name="replace"/>
  234. <xsl:choose>
  235. <xsl:when test="contains($string, $search)">
  236. <xsl:value-of select="concat(substring-before($string, $search), $replace)"/>
  237. <xsl:call-template name="substring-replace">
  238. <xsl:with-param name="string" select="substring-after($string, $search)"/>
  239. <xsl:with-param name="search" select="$search"/>
  240. <xsl:with-param name="replace" select="$replace"/>
  241. </xsl:call-template>
  242. </xsl:when>
  243. <xsl:otherwise>
  244. <xsl:value-of select="$string"/>
  245. </xsl:otherwise>
  246. </xsl:choose>
  247. </xsl:template>
  248. </xsl:stylesheet>