generateDefaultParams.xslt 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  13. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  14. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  15. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  16. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  17. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  18. exclude-result-prefixes="xtsext cm xsd xsi 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:key name="sys-param" match="/root/system/param" use="@name"/>
  22. <xsl:key name="options" match="/root/cm:account/options/value/item" use="name"/>
  23. <xsl:template match="/root">
  24. <!-- do we show the summary page? -->
  25. <xsl:if test="not(key('env-param', 'showSummary')) or key('env-param', 'showSummary') = ''">
  26. <param name="showSummary">
  27. <xsl:choose>
  28. <xsl:when test="key('options', 'showOptionSummary')/value">
  29. <xsl:choose>
  30. <xsl:when test="key('options', 'showOptionSummary')/value='true'">
  31. <xsl:value-of select="'y'"/>
  32. </xsl:when>
  33. <xsl:otherwise>
  34. <xsl:value-of select="'n'"/>
  35. </xsl:otherwise>
  36. </xsl:choose>
  37. </xsl:when>
  38. <xsl:otherwise>
  39. <xsl:value-of select="key('sys-param', 'defaultPortalPreferences')/pref[@name='runoptions']"/>
  40. </xsl:otherwise>
  41. </xsl:choose>
  42. </param>
  43. </xsl:if>
  44. <!-- generate default date and time for run later -->
  45. <xsl:variable name="timeZone" select="/root/user/param[@name='timeZoneID']"/>
  46. <xsl:variable name="xsl_UTC_timeformat" select="'yyyy-MM-dd HH:mm:00'"/>
  47. <xsl:variable name="xsl_run_date" select="xtsext:getCurrentDateTime(string($timeZone))"/>
  48. <xsl:if test="not(key('env-param', 'p_runDate')) or key('env-param','p_runDate') = ''">
  49. <param name="p_runDate">
  50. <xsl:value-of select="substring(string($xsl_run_date), 1, 10)"/>
  51. </param>
  52. </xsl:if>
  53. <xsl:if test="not(key('env-param', 'p_runTime')) or key('env-param', 'p_runTime') = ''">
  54. <param name="p_runTime">
  55. <xsl:value-of select="concat(substring(string($xsl_run_date), 12, 19), '.000')"/>
  56. </param>
  57. </xsl:if>
  58. </xsl:template>
  59. </xsl:stylesheet>