rv.xsl 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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, 2013
  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" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" version="1.0" exclude-result-prefixes="xsl rsext bus">
  10. <xsl:include href="qrsvpCommon.xsl"/>
  11. <xsl:include href="V5drillthru.xsl"/>
  12. <xsl:param name="CVDisableSelection" select="''"/>
  13. <xsl:param name="CVDisableDrill" select="''"/>
  14. <xsl:param name="genIntermediateXML" select="''"/>
  15. <xsl:param name="CVObjectRef" select="'window.oCV'"/>
  16. <xsl:param name="CVSCObjectRef" select="'window.oCVSC'"/>
  17. <xsl:param name="restoreOldDrillChartBehavior" select="'false'"/>
  18. <xsl:param name="disableTabs" select="'false'"/>
  19. <xsl:variable name="CVJSObjectRef" select="concat($CVObjectRef, $CognosViewerID)" />
  20. <xsl:variable name="CVSCJSObjectRef" select="concat($CVSCObjectRef, $CognosViewerID)" />
  21. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  22. <!-- only run these in Query Studio -->
  23. <xsl:template name="startPage"/>
  24. <xsl:template name="dropIndicators"/>
  25. <xsl:template name="drillTargetsSetup">
  26. <xsl:if test="$drillSupport!='no'">
  27. <xsl:call-template name="addDrillThroughContext">
  28. <xsl:with-param name="closeScript" select="'no'"/>
  29. </xsl:call-template>
  30. <xsl:value-of select="$CVJSObjectRef"/>.addDrillTargets(drillTargets);
  31. <xsl:text disable-output-escaping="yes">&lt;/script&gt;</xsl:text>
  32. </xsl:if>
  33. </xsl:template>
  34. <!-- used in selection -->
  35. <xsl:template name="GenEventHandlers">
  36. <xsl:if test="/Document/META-DATA or drillTargets">
  37. <xsl:if test="@layoutClass='listColumnBody' or @layoutClass='listColumnTitle' or @layoutClass='rowCell' or @layoutClass='crosstabFactCell' or @layoutClass='crosstabNodeMember' or @layoutClass='crosstabCorner' or @layoutClass='repeaterTableCell' or name()='OCHART'">
  38. <xsl:copy-of select="@cid"/>
  39. <xsl:if test="@uid">
  40. <xsl:copy-of select="@uid"/>
  41. <xsl:attribute name="name">c<xsl:value-of select="$CognosViewerID"/><xsl:value-of select="@uid"/></xsl:attribute>
  42. </xsl:if>
  43. <xsl:copy-of select="@type"/>
  44. <xsl:copy-of select="@ctx"/>
  45. <xsl:if test="@class">
  46. <xsl:attribute name="class">
  47. <xsl:if test="$CVDisableSelection != 'true'">
  48. <xsl:text>c</xsl:text><xsl:value-of select="$CognosViewerID"/><xsl:value-of select="@uid"/><xsl:text> </xsl:text>
  49. </xsl:if>
  50. <xsl:value-of select="@class" disable-output-escaping="yes"/>
  51. <xsl:if test="@styleId and $vUseStyleId='true'">
  52. <xsl:text> </xsl:text><xsl:value-of select="@styleId" disable-output-escaping="yes"/>
  53. </xsl:if>
  54. </xsl:attribute>
  55. </xsl:if>
  56. </xsl:if>
  57. </xsl:if>
  58. <xsl:if test="name()='OCHART'">
  59. <xsl:attribute name="rsvpChart">true</xsl:attribute>
  60. </xsl:if>
  61. <xsl:if test="name()='OCHART' or name()='OMAP'">
  62. <xsl:if test="$CVDisableDrill != 'true'">
  63. <xsl:attribute name="onmouseover"><xsl:value-of select="$CVJSObjectRef"/>.goDrillManager.ddc(event);</xsl:attribute>
  64. </xsl:if>
  65. </xsl:if>
  66. </xsl:template>
  67. <!-- used to add events to the main page for selection -->
  68. <xsl:template match="*[@layoutClass='page']" priority="1">
  69. <xsl:if test="$genIntermediateXML = 'true'">####intermediateStart####<xsl:copy-of select="/"/>####intermediateEnd####</xsl:if>
  70. <xsl:if test="$physicalPageCount > 0">
  71. <script type="text/javascript">
  72. <xsl:value-of select="$CVJSObjectRef"/><xsl:text>.updatePageState({"pageCount" : </xsl:text><xsl:value-of select="$physicalPageCount"/><xsl:text>, "currentPage" : </xsl:text><xsl:value-of select="$physicalPageNumber"/><xsl:text>});</xsl:text>
  73. </script>
  74. </xsl:if>
  75. <xsl:if test="/Document/ReportPageSet and $disableTabs != 'true'">
  76. <script type="text/javascript">
  77. <xsl:value-of select="$CVJSObjectRef"/><xsl:text>.setTabInfo(</xsl:text>
  78. <xsl:call-template name="createJsonTabset">
  79. <xsl:with-param name="node" select="/Document/ReportPageSet"/>
  80. </xsl:call-template>
  81. <xsl:text>);</xsl:text>
  82. </script>
  83. </xsl:if>
  84. <xsl:call-template name="preProcess"/>
  85. <table id="rt{$CognosViewerID}" cellpadding="0" cellspacing="0" border="0">
  86. <!--textarea><htmlFragment><xsl:copy-of select="/"/></htmlFragment></textarea-->
  87. <xsl:if test="$accessible='true'">
  88. <xsl:attribute name="role">presentation</xsl:attribute>
  89. </xsl:if>
  90. <xsl:if test="$CVDisableSelection != 'true'">
  91. <xsl:attribute name="onmousemove">if (typeof <xsl:value-of select="$CVSCJSObjectRef"/> != 'undefined') <xsl:value-of select="$CVSCJSObjectRef"/>.pageHover(event);</xsl:attribute>
  92. <xsl:attribute name="onclick"><xsl:value-of select="$CVJSObjectRef"/>.rvMainWnd.pageClicked(event);</xsl:attribute>
  93. <xsl:attribute name="onkeydown"><xsl:value-of select="$CVJSObjectRef"/>.onKeyDown(event);</xsl:attribute>
  94. <xsl:attribute name="onDblClick">if (typeof <xsl:value-of select="$CVSCJSObjectRef"/> != 'undefined') <xsl:value-of select="$CVSCJSObjectRef"/>.pageDoubleClicked(event);</xsl:attribute>
  95. <xsl:attribute name="onContextMenu"><xsl:value-of select="$CVJSObjectRef"/>.dcm(event, true)</xsl:attribute>
  96. </xsl:if>
  97. <xsl:call-template name="GenCommonAttributes"/>
  98. <xsl:apply-templates select="*"/>
  99. </table>
  100. <xsl:call-template name="postProcess">
  101. <xsl:with-param name="elementID" select="concat('rt', $CognosViewerID)"/>
  102. </xsl:call-template>
  103. </xsl:template>
  104. <xsl:template match="OCHART" priority="1">
  105. <xsl:variable name="uniqueId"><xsl:value-of select="concat($CognosViewerID, generate-id(.))"/></xsl:variable>
  106. <xsl:variable name="tag">
  107. <xsl:choose>
  108. <xsl:when test="@layoutClass='viz'">div</xsl:when>
  109. <xsl:otherwise>span</xsl:otherwise>
  110. </xsl:choose>
  111. </xsl:variable>
  112. <xsl:element name="{$tag}">
  113. <xsl:attribute name="tabIndex">0</xsl:attribute>
  114. <xsl:attribute name="chartContainer">true</xsl:attribute>
  115. <xsl:if test="@layoutClass='viz'">
  116. <xsl:attribute name="vizChart">true</xsl:attribute>
  117. </xsl:if>
  118. <xsl:if test="$accessible='true'">
  119. <xsl:attribute name="role">img</xsl:attribute>
  120. <xsl:if test="@altText != ''">
  121. <xsl:attribute name="aria-labelledby"><xsl:value-of select="$uniqueId"/></xsl:attribute>
  122. <span style="visibility:hidden; display:none" id="{$uniqueId}"><xsl:value-of select="@altText"/></span>
  123. </xsl:if>
  124. </xsl:if>
  125. <xsl:call-template name="GenChartImage"/>
  126. </xsl:element>
  127. </xsl:template>
  128. <xsl:template match="*[@layoutClass='textItem']" priority="1">
  129. <span>
  130. <xsl:call-template name="GenTabIndexAttribute"/>
  131. <xsl:call-template name="GenCommonAttributes"/>
  132. <!--
  133. First cell in a list or crosstab has a tabIndex of 0. We need the onfocus for those cells
  134. to fix up the aria-labelled before JAWS kicks in.
  135. -->
  136. <xsl:if test="$accessible='true'">
  137. <xsl:call-template name="AddAccessibleTagsForSpan"/>
  138. <xsl:if test="../@layoutClass = 'crosstabCorner' or (../@layoutClass = 'listColumnTitle' and count(../preceding-sibling::node())=0)">
  139. <xsl:attribute name="onfocus"><xsl:value-of select="$CVJSObjectRef"/>.onFocus(event);</xsl:attribute>
  140. </xsl:if>
  141. </xsl:if>
  142. <xsl:if test="$CVDisableDrill != 'true'">
  143. <xsl:choose>
  144. <xsl:when test="name(..)='drillTargets'">
  145. <xsl:if test="../../@isolated='true' or ../@isolated='true'">
  146. <xsl:attribute name="isolated">true</xsl:attribute>
  147. </xsl:if>
  148. </xsl:when>
  149. <xsl:otherwise>
  150. <xsl:if test="../@drillUp = 'true' or ../@drillDown = 'true' or @drillDown='true' or @drillUp='true' or ../../@drillUp = 'true' or ../../@drillDown = 'true'">
  151. <xsl:variable name="isIsolated">
  152. <xsl:choose>
  153. <xsl:when test="../@isolated='true' or @isolated='true'">true</xsl:when>
  154. <xsl:otherwise>false</xsl:otherwise>
  155. </xsl:choose>
  156. </xsl:variable>
  157. <xsl:if test="(../@drillDown = 'true' or @drillDown='true' or ../../@drillDown = 'true') and $isIsolated='false'">
  158. <xsl:attribute name="class"><xsl:text>dl </xsl:text><xsl:value-of select="@layoutClass" disable-output-escaping="yes"/></xsl:attribute>
  159. </xsl:if>
  160. <xsl:if test="$isIsolated='true'">
  161. <xsl:attribute name="isolated">true</xsl:attribute>
  162. </xsl:if>
  163. </xsl:if>
  164. </xsl:otherwise>
  165. </xsl:choose>
  166. </xsl:if>
  167. <xsl:copy-of select="@ctx"/>
  168. <xsl:value-of select="rsext:htmlencode(.)" disable-output-escaping="yes"/>
  169. </span>
  170. </xsl:template>
  171. <xsl:template match="OAREA" priority="2">
  172. <xsl:if test="MEMBER or drillTargets or MEASURE or string-length(@ctx) &gt; 0">
  173. <xsl:if test="MEMBER or MEASURE">
  174. <xsl:choose>
  175. <xsl:when test="$restoreOldDrillChartBehavior = 'true'">
  176. <xsl:attribute name="ctx">
  177. <xsl:for-each select="MEASURE">
  178. <xsl:value-of select="@ctx"/>
  179. <xsl:if test="position()!=last()">
  180. <xsl:text>:</xsl:text>
  181. </xsl:if>
  182. </xsl:for-each>
  183. <xsl:if test="MEMBER and MEASURE">
  184. <xsl:text>::</xsl:text>
  185. </xsl:if>
  186. <xsl:for-each select="MEMBER">
  187. <xsl:value-of select="@ctx"/>
  188. <xsl:if test="position()!=last()">
  189. <xsl:text>::</xsl:text>
  190. </xsl:if>
  191. </xsl:for-each>
  192. </xsl:attribute>
  193. </xsl:when>
  194. <xsl:otherwise>
  195. <xsl:copy-of select="@ctx"/>
  196. </xsl:otherwise>
  197. </xsl:choose>
  198. <xsl:attribute name="class"><xsl:value-of select="@layoutClass" disable-output-escaping="yes"/></xsl:attribute>
  199. </xsl:if>
  200. <xsl:if test="MEASURE and MEASURE != '' and $CognosViewerID = 'RS'">
  201. <xsl:attribute name="display"><xsl:value-of select="rsext:htmlencode(string(./MEASURE))" disable-output-escaping="yes"/></xsl:attribute>
  202. </xsl:if>
  203. <xsl:if test="@type='legendTitle'">
  204. <xsl:attribute name="isChartTitle">true</xsl:attribute>
  205. </xsl:if>
  206. <xsl:if test="@type='ordinalAxisTitle'">
  207. <xsl:attribute name="isChartTitle">true</xsl:attribute>
  208. </xsl:if>
  209. <xsl:if test="drillTargets">
  210. <xsl:attribute name="dtTargets">
  211. <xsl:apply-templates select="./drillTargets/*" mode="drillTargets"/>
  212. </xsl:attribute>
  213. </xsl:if>
  214. <xsl:if test="$isIE">
  215. <xsl:attribute name="onmouseup"><xsl:value-of select="$CVJSObjectRef"/>.pcc(event)</xsl:attribute>
  216. </xsl:if>
  217. </xsl:if>
  218. </xsl:template>
  219. </xsl:stylesheet>