handleResultTemplate.xslt 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: AGS
  5. (C) Copyright IBM Corp. 2005, 2009
  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" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:req-params="http://developer.cognos.com/schemas/request/params" xmlns:xts="http://developer.cognos.com/schemas/xts/" exclude-result-prefixes="xtsext pf req-params xts">
  9. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  10. <pf:variables/>
  11. <pf:serialize-xml/>
  12. <xsl:template match="/">
  13. <!-- the setSchedule page expects the scheduleParameters to live in /root/env/param which are then taken
  14. and copied into req:params:param prior to the morphlet call, see ags/navigator.xslt -->
  15. <!-- we can have multiple items returned in the response - have to handle them all -->
  16. <xts:sequence>
  17. <!-- remove the last version of the returned vars -->
  18. <xsl:for-each select="/root/*[local-name()='morphletResponse']/*">
  19. <xts:delete select="/root/env/param[@name='{local-name()}']"/>
  20. </xsl:for-each>
  21. <!-- copy the schedule summary out into the params -->
  22. <xsl:if test="/root/morphletResponse/scheduleParameters/param[@name='Summary_schedule']">
  23. <!-- update the summary schedule -->
  24. <xts:replace select="/root/agent_definition/schedule">
  25. <schedule>
  26. <xsl:value-of select="/root/morphletResponse/scheduleParameters/param[@name='Summary_schedule']"/>
  27. </schedule>
  28. </xts:replace>
  29. </xsl:if>
  30. <xsl:if test="/root/morphletResponse/param[@name='conditionSummary']">
  31. <!-- update the summary schedule -->
  32. <xts:replace select="/root/agent_definition/condition">
  33. <condition selectedTab="{/root/morphletResponse/param[@name='conditionSummary']/@selectedTab}">
  34. <xsl:value-of select="/root/morphletResponse/param[@name='conditionSummary']"/>
  35. </condition>
  36. </xts:replace>
  37. </xsl:if>
  38. <!-- create the encoded result -->
  39. <xts:append select="/root/env">
  40. <!-- this is a bit strange - taskName doesn't get wrapped up - but we're going to assume that everything else does -->
  41. <xsl:for-each select="/root/*[local-name()='morphletResponse']/*[local-name()!='taskName' and local-name()!='conditionSummary' and local-name() !='tabResult']">
  42. <!-- create the encoded response parameter -->
  43. <xts:transform src="portal/controls/create_web64_param.xslt" processor="XSLT">
  44. <param name="{local-name()}">
  45. <passport>
  46. <xsl:value-of select="$passport"/>
  47. </passport>
  48. <markup>
  49. <xts:transform name="XMLEncode">
  50. <xsl:copy-of select="."/>
  51. </xts:transform>
  52. </markup>
  53. </param>
  54. </xts:transform>
  55. </xsl:for-each>
  56. <!-- if there's a task name - we just return it -->
  57. <xsl:if test="/root/*[local-name()='morphletResponse']/*[local-name()='tabResult']">
  58. <param name="tabResult">
  59. <xsl:value-of select="/root/*[local-name()='morphletResponse']/*[local-name()='tabResult']"/>
  60. </param>
  61. </xsl:if>
  62. <!-- if there's a task name - we just return it -->
  63. <xsl:if test="/root/*[local-name()='morphletResponse']/*[local-name()='taskName']">
  64. <param name="taskName">
  65. <xsl:value-of select="/root/*[local-name()='morphletResponse']/*[local-name()='taskName']"/>
  66. </param>
  67. </xsl:if>
  68. </xts:append>
  69. <!-- we're getting rid of the waste products here - we know the result object of the morphlet - so get rid of
  70. all but the result object -->
  71. <!-- clean everything else up - we have to create the select statement though
  72. This is mostly fixed - but we add the parameters from the response into the list of items to ignore -->
  73. <xsl:variable name="selectPath">
  74. <xsl:text>/root/env/param[not(starts-with(@name, 'agsSave')</xsl:text>
  75. <xsl:text> or starts-with(@name,'AgentTask')</xsl:text>
  76. <xsl:text> or starts-with(@name,'ps_nav')</xsl:text>
  77. <xsl:text> or @name='agent_definition_blob'</xsl:text>
  78. <xsl:text> or @name='cafcontextid'</xsl:text>
  79. <xsl:text> or @name='tabSelectedID'</xsl:text>
  80. <xsl:text> or @name='prevTabID'</xsl:text>
  81. <xsl:text> or @name='newTaskType'</xsl:text>
  82. <xsl:text> or @name='itemSelected'</xsl:text>
  83. <xsl:text> or @name='itemNewLocation'</xsl:text>
  84. <xsl:text> or @name='agentItemOp'</xsl:text>
  85. <xsl:text> or @name='m'</xsl:text>
  86. <xsl:text> or @name='packRoot'</xsl:text>
  87. <xsl:text> or @name='b_action'</xsl:text>
  88. <xsl:text> or @name='m_path'</xsl:text>
  89. <xsl:text> or @name='controller_state'</xsl:text>
  90. <xsl:text> or @name='has_prompts'</xsl:text>
  91. <xsl:for-each select="/root/*[local-name()='morphletResponse']/*">
  92. <xsl:text> or @name='</xsl:text>
  93. <xsl:value-of select="local-name()"/>
  94. <xsl:text>'</xsl:text>
  95. </xsl:for-each>
  96. <xsl:text>)]</xsl:text>
  97. </xsl:variable>
  98. <xts:delete select="{$selectPath}"/>
  99. </xts:sequence>
  100. </xsl:template>
  101. </xsl:stylesheet>