attachment_request_params.xslt 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. Transform to convert the runOptions for a report into request parameters for attaching the report to an email
  10. -->
  11. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/" exclude-result-prefixes="xsl xts">
  12. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  13. <xsl:template match="/root">
  14. <!-- is the report available for attachment to an email -->
  15. <report>
  16. <!-- set the properties for the attachment - set the path (AgentTaskID) - taskName -->
  17. <searchPath>
  18. <xsl:value-of select="./id"/>
  19. </searchPath>
  20. <defaultName>
  21. <xsl:value-of select="./taskName"/>
  22. </defaultName>
  23. <!-- set the locale - either the value of the outputLocale runOption - or if that isn't there - use the contentLocale from the user -->
  24. <xsl:for-each select="reportOptions/*[local-name()='options']/*[local-name()='value']/*[local-name()='item' and ./*[local-name()='name']='outputLocale']/*[local-name()='value']/*[local-name()='item']">
  25. <locale>
  26. <xsl:value-of select="."/>
  27. </locale>
  28. </xsl:for-each>
  29. <!-- set the formats as well from the outputFormat runOption -->
  30. <xsl:for-each select="reportOptions/*[local-name()='options']/*[local-name()='value']/*[local-name()='item' and ./*[local-name()='name']='outputFormat']/*[local-name()='value']/*[local-name()='item']">
  31. <format>
  32. <xsl:value-of select="."/>
  33. </format>
  34. </xsl:for-each>
  35. <!-- also have to cater for powerplay report option format - which isn't an array -->
  36. <xsl:for-each select="reportOptions/*[local-name()='options']/*[local-name()='value']/*[local-name()='item' and contains(./@*[local-name()='type'], 'powerPlay8OptionOutputFormat')]/*[local-name()='value']">
  37. <format>
  38. <xsl:value-of select="."/>
  39. </format>
  40. </xsl:for-each>
  41. <!-- if we don't have a format - the email page will display the format based on the default user format. For PP we don't want this - we want to force it to be PDF -->
  42. <xsl:if test="starts-with(./m_class, 'powerPlay') and not(reportOptions/*[local-name()='options']/*[local-name()='value']/*[local-name()='item' and contains(./@*[local-name()='type'], 'powerPlay8OptionOutputFormat')])">
  43. <format>
  44. <xsl:text>PDF</xsl:text>
  45. </format>
  46. </xsl:if>
  47. </report>
  48. </xsl:template>
  49. </xsl:stylesheet>