upgradeJobOptions.xslt 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ps
  5. (C) Copyright IBM Corp. 2005, 2011
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <xsl:stylesheet version="1.0"
  13. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  14. xmlns:x="x"
  15. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  16. exclude-result-prefixes="xsl xsi x">
  17. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  18. <xsl:template match="*[local-name()='options']" priority="1">
  19. <xsl:element name="options" namespace="{namespace-uri()}">
  20. <xsl:apply-templates/>
  21. </xsl:element>
  22. </xsl:template>
  23. <xsl:template match="*[local-name()='value']" priority="1">
  24. <!-- want to see if savePromptCache already exists -->
  25. <xsl:variable name="promptCacheModeAlreadyExists">
  26. <xsl:value-of select="*[local-name()='item']/*[local-name()='name']='promptCacheMode'"/>
  27. </xsl:variable>
  28. <xsl:copy>
  29. <xsl:copy-of select="@*"/>
  30. <xsl:for-each select="*[local-name()='item']">
  31. <xsl:choose>
  32. <!-- deprecated 'savePromptCache' exists, but the new 'promptCacheMode' does not. Therefore, add
  33. the new option set to corresponding values.-->
  34. <xsl:when test="./*[local-name()='name']='savePromptCache' and $promptCacheModeAlreadyExists='false'">
  35. <item xsi:type="bus:runOptionPromptCacheMode">
  36. <name xsi:type="bus:runOptionEnum">promptCacheMode</name>
  37. <value xsi:type="bus:promptCacheModeEnum">
  38. <xsl:choose>
  39. <xsl:when test="*[local-name()='value']='true'">create</xsl:when>
  40. <xsl:otherwise>none</xsl:otherwise>
  41. </xsl:choose>
  42. </value>
  43. </item>
  44. </xsl:when>
  45. <!-- simply copy the option if it's not the deprecated 'savePromptCache' option. -->
  46. <xsl:when test="not(./*[local-name()='name']='savePromptCache')">
  47. <xsl:copy-of select="."/>
  48. </xsl:when>
  49. </xsl:choose>
  50. </xsl:for-each>
  51. </xsl:copy>
  52. </xsl:template>
  53. <xsl:template match="text()" priority="0"/>
  54. </xsl:stylesheet>