cleanEnv.xslt 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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, 2014
  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. <!--
  13. Transform to remove any unwanted params from the env that gets passed to the buildOptionItems.xslt transform.
  14. -->
  15. <xsl:stylesheet version="1.0"
  16. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  17. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  18. exclude-result-prefixes="xts">
  19. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  20. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  21. <xsl:template match="/root" priority="3">
  22. <env>
  23. <xsl:apply-templates select="/root/env"/>
  24. </env>
  25. </xsl:template>
  26. <xsl:variable name="overrideOptions" select="key('env-param','override_default_reportOptions')='true' or key('env-param','override_outputFormat_option')='true' or not(key('env-param','changed_override_default_reportOptions'))"/>
  27. <!--
  28. **************
  29. RUN OPTIONS
  30. **************
  31. -->
  32. <!-- only keep m_ro_outputFormat if we are not using formats from the advanced options page -->
  33. <xsl:template match="*[local-name()='param' and @name='m_ro_outputFormat']" priority="2">
  34. <xsl:if test="(not(/root/env/param[starts-with(@name, 'm_ro_outputFormat_')]))">
  35. <param name="{@name}"><xsl:value-of select="."/></param>
  36. </xsl:if>
  37. </xsl:template>
  38. <!-- only keep m_ro_outputFormat_HTML, selectionBasedFeatures and m_ro_verticalElements if the HTML checkbox was checked -->
  39. <xsl:template match="*[local-name()='param' and (@name='m_ro_outputFormat_HTML' or @name='m_ro_selectionBasedFeatures' or @name='m_ro_verticalElements')]" priority="2">
  40. <xsl:if test="(not(key('env-param','changed_m_ro_outputF_HTML_Type')) or key('env-param','m_ro_outputF_HTML_Type')='true') and $overrideOptions">
  41. <param name="{@name}"><xsl:value-of select="."/></param>
  42. </xsl:if>
  43. </xsl:template>
  44. <!-- only keep m_ro_outputFormat_XLS2000 if the XLS checkbox was checked -->
  45. <xsl:template match="*[local-name()='param' and @name='m_ro_outputFormat_XLS2000']" priority="2">
  46. <xsl:if test="key('env-param','m_ro_outputF_XLS2000_Type') = 'true' and $overrideOptions">
  47. <param name="{@name}"><xsl:value-of select="."/></param>
  48. </xsl:if>
  49. </xsl:template>
  50. <!-- only keep the printer address if the print checkbox was checked -->
  51. <xsl:template match="*[local-name()='param' and (@name='m_ro_printerAddress' or @name='m_ro_printer')]" priority="2">
  52. <xsl:if test="key('env-param','m_ro_print') = 'true' and $overrideOptions">
  53. <param name="{@name}"><xsl:value-of select="."/></param>
  54. </xsl:if>
  55. </xsl:template>
  56. <!-- only keep the outputFormats if the specify checkbox is checked or there wasn't a specify checkbox -->
  57. <xsl:template match="*[local-name()='param' and starts-with(@name, 'm_ro_outputFormat')]" priority="1">
  58. <xsl:if test="(not(key('env-param','changed_specify_format')) or key('env-param','specify_format')='checked') and $overrideOptions">
  59. <param name="{@name}"><xsl:value-of select="."/></param>
  60. </xsl:if>
  61. </xsl:template>
  62. <!-- only keep the outputLocale if the specify checkbox is checked or there wasn't a specify checkbox -->
  63. <xsl:template match="*[local-name()='param' and @name='m_ro_outputLocale']" priority="1">
  64. <xsl:if test="(not(key('env-param','changed_specify_language')) or key('env-param','specify_language')='checked') and $overrideOptions">
  65. <param name="{@name}"><xsl:value-of select="."/></param>
  66. </xsl:if>
  67. </xsl:template>
  68. <!-- only keep the PDF options if PDF is checked and they're not set to default -->
  69. <xsl:template match="*[local-name()='param' and (@name='m_ro_outputPageDefinition' or @name='m_ro_outputPageOrientation' or starts-with(@name, 'm_pdf_'))]" priority="1">
  70. <xsl:if test="(key('env-param','visited_run_options_property')='true' or /root/env/param[starts-with(@name, 'm_ro_outputFormat')] = 'PDF') and . != 'default' and $overrideOptions">
  71. <param name="{@name}"><xsl:value-of select="."/></param>
  72. </xsl:if>
  73. </xsl:template>
  74. <!-- only keep the PDF options if PDF is checked and they're not set to default -->
  75. <xsl:template match="*[local-name()='param' and starts-with(@name, 'm_arc_')]" priority="1">
  76. <xsl:if test="key('env-param','m_ro_archive') = 'true' and $overrideOptions">
  77. <param name="{@name}"><xsl:value-of select="."/></param>
  78. </xsl:if>
  79. </xsl:template>
  80. <xsl:template match="*[local-name()='param' and (starts-with(@name,'m_ro_') or @name='ro_printer_kw' or @name='save_how')]">
  81. <!-- if the override checkbox is present, and it's checked then keep the runOptions. The prompt runOptions isn't contained in the
  82. the same dynamic div, so always include it -->
  83. <xsl:if test="$overrideOptions or @name='m_ro_prompt'">
  84. <param name="{@name}"><xsl:value-of select="."/></param>
  85. </xsl:if>
  86. </xsl:template>
  87. <!--
  88. **************
  89. DEPLOYMENT OPTIONS
  90. **************
  91. -->
  92. <xsl:template match="*[local-name()='param' and @name='deploymentro_upgradeClasses']" priority="2">
  93. <xsl:if test="key('env-param','deploymentro_upgrade')='upgrade'">
  94. <param name="{@name}"><xsl:value-of select="."/></param>
  95. </xsl:if>
  96. </xsl:template>
  97. <!--
  98. **************
  99. POWERPLAY OPTIONS
  100. **************
  101. -->
  102. <xsl:template match="*[local-name()='param' and @name='m_ppro_outputFormat']" priority="1">
  103. <param name="{@name}"><xsl:value-of select="."/></param>
  104. </xsl:template>
  105. <xsl:template match="*[local-name()='param']" priority="0">
  106. <param name="{@name}"><xsl:value-of select="."/></param>
  107. </xsl:template>
  108. </xsl:stylesheet>