qrsvpCommon.xsl 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: Viewer
  5. (C) Copyright IBM Corp. 2001, 2017
  6. US Government Users Restricted Rights - Use, duplication or
  7. disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. -->
  9. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rsext="xalan://com.cognos.reportserver.ext.RSExt" version="1.0" exclude-result-prefixes="xsl rsext">
  10. <xsl:include href="V5environment.xsl"/>
  11. <xsl:include href="V5ReportEngine.xsl"/>
  12. <!-- Include needed for prompting -->
  13. <xsl:include href="../../ps/prompting/p_include_V5ParamSafe.xsl"/>
  14. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  15. <xsl:param name="RSIncludeAlias" select="''"/>
  16. <xsl:param name="UseCDATASections" select="'true'"/>
  17. <xsl:variable name="promptLocale" select="$contentLocale"/>
  18. <xsl:variable name="promptFormName" select="'formWarpRequest'"/>
  19. <xsl:variable name="CDATABegin">
  20. <xsl:choose>
  21. <xsl:when test="$UseCDATASections = 'true'">
  22. <xsl:text>//&lt;![CDATA[</xsl:text>
  23. </xsl:when>
  24. <xsl:otherwise>
  25. <xsl:text></xsl:text>
  26. </xsl:otherwise>
  27. </xsl:choose>
  28. </xsl:variable>
  29. <xsl:variable name="CDATAEnd">
  30. <xsl:choose>
  31. <xsl:when test="$UseCDATASections = 'true'">
  32. <xsl:text>//]]&gt;</xsl:text>
  33. </xsl:when>
  34. <xsl:otherwise>
  35. <xsl:text></xsl:text>
  36. </xsl:otherwise>
  37. </xsl:choose>
  38. </xsl:variable>
  39. <xsl:template name="startScript">
  40. <xsl:text disable-output-escaping="yes">&lt;script type="text/javascript"></xsl:text>
  41. <xsl:value-of disable-output-escaping="yes" select="$CDATABegin" />
  42. <!-- Note: The newline between the opening and closing xsl:text tags is important!
  43. You want just the CDATA to be commented out, not the entire content of the script -->
  44. <xsl:text>
  45. </xsl:text>
  46. </xsl:template>
  47. <xsl:template name="endScript">
  48. <xsl:value-of disable-output-escaping="yes" select="$CDATAEnd" />
  49. <xsl:text disable-output-escaping="yes">&lt;/script></xsl:text>
  50. <!-- Note: The newline between the opening and closing xsl:text tags is important!
  51. You want just the CDATA to be commented out, not the entire content of the script -->
  52. <xsl:text>
  53. </xsl:text>
  54. </xsl:template>
  55. <xsl:template match="/Document">
  56. <!-- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved. -->
  57. <!-- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated). -->
  58. <xsl:call-template name="chartConfig"/>
  59. <!-- Add prompt control javascript and style sheets -->
  60. <xsl:call-template name="getPromptHeadIncludes">
  61. <xsl:with-param name="promptLocale" select="$promptLocale"/>
  62. <xsl:with-param name="promptContentLocale" select="$contentLocale"/>
  63. </xsl:call-template>
  64. <xsl:apply-templates select="/Document/styleOptions"/>
  65. <xsl:if test=" $RSIncludeAlias != '' ">
  66. <xsl:variable name="RSAliasDoc" select=" document( 'rs_alias.xml' ) "/>
  67. <xsl:call-template name="LoadRSAlias">
  68. <xsl:with-param name="doc" select="$RSAliasDoc"/>
  69. <xsl:with-param name="alias" select="$RSIncludeAlias"/>
  70. </xsl:call-template>
  71. </xsl:if>
  72. <xsl:call-template name="drillTargetsSetup"/>
  73. <xsl:call-template name="addSelectionController"/>
  74. <xsl:apply-templates select="META-DATA"/>
  75. <xsl:apply-templates select="CONTEXT-DATA"/>
  76. <xsl:apply-templates select="DATA"/>
  77. <xsl:call-template name="dropIndicators"/>
  78. </xsl:template>
  79. <xsl:template name="LoadRSAlias">
  80. <xsl:param name="doc"/>
  81. <xsl:param name="alias"/>
  82. <xsl:choose>
  83. <xsl:when test=" contains( $alias, ',' ) ">
  84. <xsl:call-template name="LoadRSAlias">
  85. <xsl:with-param name="doc" select="$doc"/>
  86. <xsl:with-param name="alias" select=" substring-before( $alias, ',' ) "/>
  87. </xsl:call-template>
  88. <xsl:call-template name="LoadRSAlias">
  89. <xsl:with-param name="doc" select="$doc"/>
  90. <xsl:with-param name="alias" select=" substring-after( $alias, ',' ) "/>
  91. </xsl:call-template>
  92. </xsl:when>
  93. <xsl:when test=" $alias != '' ">
  94. <xsl:value-of select=" $doc/aliases/alias[ @name = $alias ] " disable-output-escaping="yes"/>
  95. </xsl:when>
  96. </xsl:choose>
  97. </xsl:template>
  98. <xsl:template name="addSelectionController">
  99. <xsl:call-template name="startScript" />
  100. <xsl:choose>
  101. <xsl:when test="/Document/META-DATA or /Document/CONTEXT-DATA">
  102. <xsl:value-of select="$CVSCJSObjectRef"/><xsl:text>.setSelectionBasedFeaturesEnabled(true);</xsl:text>
  103. </xsl:when>
  104. <xsl:otherwise>
  105. <xsl:value-of select="$CVSCJSObjectRef"/><xsl:text>.setSelectionBasedFeaturesEnabled(false);</xsl:text>
  106. </xsl:otherwise>
  107. </xsl:choose>
  108. <xsl:choose>
  109. <xsl:when test="/Document/META-DATA/@drillUpDown='true'">
  110. <xsl:value-of select="$CVSCJSObjectRef"/><xsl:text>.setDrillUpDownEnabled(true);</xsl:text>
  111. </xsl:when>
  112. <xsl:otherwise>
  113. <xsl:value-of select="$CVSCJSObjectRef"/><xsl:text>.setDrillUpDownEnabled(false);</xsl:text>
  114. </xsl:otherwise>
  115. </xsl:choose>
  116. <xsl:choose>
  117. <xsl:when test="/Document/META-DATA/@modelBasedDrillThru='true'">
  118. <xsl:value-of select="$CVSCJSObjectRef"/><xsl:text>.setModelDrillThroughEnabled(true);</xsl:text>
  119. </xsl:when>
  120. <xsl:otherwise>
  121. <xsl:value-of select="$CVSCJSObjectRef"/><xsl:text>.setModelDrillThroughEnabled(false);</xsl:text>
  122. </xsl:otherwise>
  123. </xsl:choose>
  124. <xsl:call-template name="endScript" />
  125. </xsl:template>
  126. <xsl:template match="META-DATA">
  127. <xsl:call-template name="startScript" />
  128. <xsl:for-each select="Block">
  129. <xsl:value-of select="$CVSCJSObjectRef"/>
  130. <xsl:text>.addMetaData(</xsl:text>
  131. <xsl:value-of select="." disable-output-escaping="yes"/>
  132. <xsl:text>);</xsl:text>
  133. </xsl:for-each>
  134. <xsl:call-template name="endScript" />
  135. </xsl:template>
  136. <xsl:template match="CONTEXT-DATA">
  137. <xsl:call-template name="startScript" />
  138. <xsl:for-each select="*[local-name()=$contextBlock]">
  139. <xsl:value-of select="$CVSCJSObjectRef"/>
  140. <xsl:text>.addContextData(</xsl:text>
  141. <xsl:value-of select="." disable-output-escaping="yes"/>
  142. <xsl:text>);</xsl:text>
  143. </xsl:for-each>
  144. <xsl:call-template name="endScript" />
  145. </xsl:template>
  146. </xsl:stylesheet>