get-output.xslt 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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"
  13. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  14. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  15. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  16. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  17. <xsl:template match="queryResult/item">
  18. <xsl:copy-of select="."/>
  19. </xsl:template>
  20. <xsl:template match="queryResult/item[@xsi:type = 'cm:output' or @xsi:type = 'cm:graphic']">
  21. <xsl:choose>
  22. <xsl:when test="format/value = 'XHTML'">
  23. <report><xsl:apply-templates/></report>
  24. </xsl:when>
  25. <xsl:when test="dataType/value = 'image/png'">
  26. <chart><xsl:value-of select="storeID/value"/></chart>
  27. </xsl:when>
  28. <xsl:otherwise>
  29. <error>Invalid format: <xsl:value-of select="format/value"/></error>
  30. </xsl:otherwise>
  31. </xsl:choose>
  32. </xsl:template>
  33. <!-- Extract the response from Burgundy -->
  34. <xsl:template match="*[local-name()='runSpecificationResponse']">
  35. <xsl:value-of select="xtsext:xmldecode(result/details/item/data)" disable-output-escaping="yes"/>
  36. </xsl:template>
  37. <!--
  38. Extract the data property from the CM object. It is base64 encoded and has an XML header (<?xml?>)
  39. at the front of it, so decode it and remove the header.
  40. -->
  41. <xsl:template match="data">
  42. <xsl:value-of select="concat('&lt;html', substring-after(xtsext:base64decode(string(value), false()), '&lt;html'))" disable-output-escaping="yes"/>
  43. </xsl:template>
  44. <xsl:template match="*">
  45. <xsl:apply-templates/>
  46. </xsl:template>
  47. <xsl:template match="text()"/>
  48. </xsl:stylesheet>