generateDefaultNewsitemOptions.xslt 5.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ASV
  5. (C) Copyright IBM Corp. 2005, 2010
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  9. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  10. xmlns:rdsad="http://developer.cognos.com/schemas/xts/rdsad/"
  11. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  12. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  13. exclude-result-prefixes="xsl xtsext xts rdsad pf">
  14. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  15. <xsl:template match="/">
  16. <xts:sequence>
  17. <!-- we're adding flag to say we've done this process once and for all -->
  18. <xts:append select="/root/env">
  19. <param name="m_subData_newsitem_options">true</param>
  20. </xts:append>
  21. <!-- have to check that we've got a newsItem headline -->
  22. <xsl:if test="not(/root/env/param[@name='m_subData_newsitem_headline'])">
  23. <xsl:variable name="reportName">
  24. <xsl:value-of select="/root/env/param[@name='m_subData_periodical_producer_defaultName']"/>
  25. </xsl:variable>
  26. <!-- -->
  27. <xsl:variable name="measureName">
  28. <xsl:value-of select="/root/env/param[@name='m_subData_measure_name']"/>
  29. </xsl:variable>
  30. <!-- -->
  31. <xsl:variable name="operator">
  32. <xsl:call-template name="conditionEnumShortValue">
  33. <xsl:with-param name="conditionEnum">
  34. <xsl:value-of select="/root/env/param[@name='m_sub_operation']"/>
  35. </xsl:with-param>
  36. </xsl:call-template>
  37. </xsl:variable>
  38. <!-- -->
  39. <xsl:variable name="value1">
  40. <xsl:value-of select="/root/env/param[@name='m_sub_measure_value']"/>
  41. </xsl:variable>
  42. <!-- -->
  43. <xsl:variable name="value2">
  44. <xsl:value-of select="/root/env/param[@name='m_sub_measure_value1']"/>
  45. </xsl:variable>
  46. <xsl:variable name="newsItemHeadline">
  47. <xsl:choose>
  48. <xsl:when test="/root/env/param[@name='m_sub_type']='nonMetric' and /root/env/param[@name='m_sub_operation']='between' "><xts:string id="IDS_CUSTSUB_DEFAULT_SUBJECT2"><xts:param name="reportName"><xsl:value-of select="$reportName"/></xts:param><xts:param name="measureName"><xsl:value-of select="$measureName"/></xts:param><xts:param name="operator"><xsl:value-of select="$operator"/></xts:param><xts:param name="value1"><xsl:value-of select="$value1"/></xts:param><xts:param name="value2"><xsl:value-of select="$value2"/></xts:param></xts:string></xsl:when>
  49. <xsl:when test="/root/env/param[@name='m_sub_type']='nonMetric' and not(/root/env/param[@name='m_sub_operation']='between')"><xts:string id="IDS_CUSTSUB_DEFAULT_SUBJECT"><xts:param name="reportName"><xsl:value-of select="$reportName"/></xts:param><xts:param name="measureName"><xsl:value-of select="$measureName"/></xts:param><xts:param name="operator"><xsl:value-of select="$operator"/></xts:param><xts:param name="value1"><xsl:value-of select="$value1"/></xts:param></xts:string></xsl:when>
  50. <xsl:when test="/root/env/param[@name='m_sub_type']='metric' "><xts:string id="IDS_CUSTSUB_DEFAULT_SUBJECT_METRIC"><xts:param name="measureName"><xsl:value-of select="$measureName"/></xts:param></xts:string></xsl:when>
  51. </xsl:choose>
  52. </xsl:variable>
  53. <xts:append select="/root/env">
  54. <param name="m_subData_newsitem_headline">
  55. <xsl:value-of select="$newsItemHeadline"/>
  56. </param>
  57. <param name="m_subData_newsitem_taskName">
  58. <xsl:value-of select="$newsItemHeadline"/>
  59. </param>
  60. </xts:append>
  61. </xsl:if>
  62. <!-- have to check we've got a newsItem channel -->
  63. <xsl:if test="not(/root/env/param[@name='m_subData_newsitem_path']) or /root/env/param[@name='m_subData_newsitem_path']='' ">
  64. <!-- check to see if it's empty - perhaps the channel was deleted -->
  65. <xsl:if test="/root/env/param[@name='m_subData_newsitem_path']=''">
  66. <xts:delete select="/root/env/param[@name='m_subData_newsitem_path"/>
  67. </xsl:if>
  68. <xts:append select="/root/env">
  69. <param name="m_subData_newsitem_path">
  70. <xsl:choose>
  71. <!-- check to see if the periodical location is writeable - if so we put the newsitem there -->
  72. <xsl:when test="contains(/root/env/param[@name='m_subData_periodical_producer_parent_permissions'], 'write')">
  73. <!-- make it default to myfolders -->
  74. <xsl:value-of select="/root/env/param[@name='m_subData_periodical_producer_parent_searchPath']"/>
  75. </xsl:when>
  76. <!-- otherwise we put it in myfolders -->
  77. <xsl:otherwise>
  78. <!-- make it default to myfolders -->
  79. <xsl:value-of select="concat(/root/session/param[@name='e_hp'], '/folder')"/>
  80. </xsl:otherwise>
  81. </xsl:choose>
  82. </param>
  83. </xts:append>
  84. </xsl:if>
  85. </xts:sequence>
  86. </xsl:template>
  87. <rdsad:enumTemplates/>
  88. </xsl:stylesheet>