decodeReportOptions.xslt 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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, 2008
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. ================================================================================
  10. decodeReportOptions
  11. A helper block to expand the content or report options and place them under /root/agent_item
  12. The node is stripped out to make '/root/agent_item/options' which can then be saved to CM
  13. ================================================================================
  14. -->
  15. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xsl xtsext">
  16. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  17. <xsl:template match="/">
  18. <xts:sequence>
  19. <!-- expand each of the report options and add to its agent item -->
  20. <xsl:for-each select="/root/agent_item[@type='report' or @type='content' or @type='index']">
  21. <xsl:variable name="taskType" select="@type"/>
  22. <xsl:variable name="pos" select="position()"/>
  23. <xsl:variable name="id" select="./@id"/>
  24. <xsl:variable name="inputBlob">
  25. <xsl:choose>
  26. <xsl:when test="@type='report'">reportOptions</xsl:when>
  27. <xsl:when test="@type='content'">cmOptions</xsl:when>
  28. <xsl:when test="@type='index'">cmOptions</xsl:when>
  29. </xsl:choose>
  30. </xsl:variable>
  31. <xsl:variable name="options" select="/root/agent_item[@id=$id]/param[@name=$inputBlob]"/>
  32. <!--xsl:message>options:<xsl:value-of select="$options"/></xsl:message>
  33. <xsl:message>inputBlob:<xsl:value-of select="$inputBlob"/></xsl:message>
  34. <xsl:message>taskType:<xsl:value-of select="$taskType"/></xsl:message-->
  35. /root/agent_item/options
  36. <xsl:if test="$options!=''">
  37. <!-- decode the report options and append to the DOM -->
  38. <xts:append select="/root/agent_item[@id='{$id}'][@type='{$taskType}']">
  39. <xts:transform name="XMLDecode">
  40. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap_settemplatename_decodereportoptions_settemplateid_decodereportoptions001',string($options)), true() )"/>
  41. </xts:transform>
  42. </xts:append>
  43. <!-- replace /root/agent_item/<inputBlob>/options with /root/agent_item/options-->
  44. <xts:replace select="/root/agent_item[@id='{$id}'][@type='{$taskType}']/{$inputBlob}">
  45. <xts:queryNode select="/root/agent_item[@id='{$id}'][@type='{$taskType}']/{$inputBlob}/*[local-name()='options']"/>
  46. </xts:replace>
  47. </xsl:if>
  48. </xsl:for-each>
  49. </xts:sequence>
  50. </xsl:template>
  51. </xsl:stylesheet>