RSUpgradeCombinationChart.xsl 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: rspecupgrade
  5. (C) Copyright IBM Corp. 2005, 2010
  6. US Government Users Restricted Rights - Use, duplication or disclosure
  7. restricted by GSA ADP Schedule Contract with IBM Corp.
  8. -->
  9. <!-- COPYRIGHT_DATA { 'YEAR':[2005, 2009], 'RELEASE':['colorado_wave1'], 'VISIBLE':'YES', 'COMPONENT':'rspecupgrade' }-->
  10. <!--All lines above the COPYRIGHT_DATA line will be replaced when copyright notices are generated. -->
  11. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:baltic="http://developer.cognos.com/schemas/report/1/" xmlns="http://developer.cognos.com/schemas/report/2.0/" xmlns:date="http://exslt.org/dates-and-times" xmlns:exsl="http://exslt.org/common" xmlns:xalan="http://xml.apache.org/xalan" xmlns:java="http://xml.apache.org/xalan/java" extension-element-prefixes="xalan date exsl" exclude-result-prefixes="xalan java baltic date exsl">
  12. <xsl:template name="combinationChartTemplate">
  13. <combinationChart>
  14. <xsl:variable name="p_depth" select="baltic:combinationChart/@depth"/>
  15. <xsl:if test="$p_depth != ''">
  16. <xsl:attribute name="depth"><xsl:value-of select="$p_depth"/></xsl:attribute>
  17. </xsl:if>
  18. <xsl:call-template name="matchSeriesColorTemplate"/>
  19. <xsl:variable name="v_axis" select="baltic:combinationChart/@axis"/>
  20. <xsl:if test="$v_axis = 'bipolar' or $v_axis = 'dual'">
  21. <xsl:attribute name="axisY2Position"><xsl:value-of select="$v_axis"/></xsl:attribute>
  22. </xsl:if>
  23. <xsl:call-template name="standardChartAttributesTemplate"/>
  24. <xsl:call-template name="generateMasterDetailLinks2">
  25. <xsl:with-param name="p_frame" select="."/>
  26. </xsl:call-template>
  27. <xsl:call-template name="legendTemplate"/>
  28. <xsl:call-template name="axisTemplate"/>
  29. <combinationChartTypes>
  30. <xsl:call-template name="generateCombinationChartTypes"/>
  31. </combinationChartTypes>
  32. <xsl:call-template name="commonClustersTemplate">
  33. <xsl:with-param name="p_addChartContents" select="'true'"/>
  34. </xsl:call-template>
  35. <xsl:call-template name="defaultMeasureTemplate"/>
  36. <xsl:call-template name="commonChartTemplate"/>
  37. <xsl:call-template name="commonChartMarkerTemplate"/>
  38. <xsl:call-template name="commonChartBaselineTemplate">
  39. <xsl:with-param name="chartType" select="'combinationChart'"/>
  40. <xsl:with-param name="standardType" select="baltic:combinationChart/@standardType"/>
  41. </xsl:call-template>
  42. </combinationChart>
  43. </xsl:template>
  44. <xsl:template name="matchSeriesColorTemplate">
  45. <xsl:variable name="v_matchSeriesColor" select="baltic:combinationChart/@matchSeriesColor"/>
  46. <xsl:variable name="v_refQuery" select="@refQuery"/>
  47. <xsl:if test="$v_matchSeriesColor != ''">
  48. <!--
  49. In the case where the chart's associated query has no row edges, i.e. series, we disable
  50. the matchSeriesColor attribute, regardless of what it was set to originally. This is to
  51. prevent the attribute from being applied to series measures in Bering when it wasn't applied
  52. to any in Baltic (since measures are moved from "Measures" to "Series" in the upgrade).
  53. See Trakker #528738.
  54. Note that this rule may need to be applied to other chart attributes in the future.
  55. -->
  56. <xsl:attribute name="matchSeriesColor"><xsl:choose><xsl:when test="count(//baltic:BIQuery[@name=$v_refQuery]/baltic:summary/baltic:rowEdge/baltic:level) = 0"><xsl:value-of select="'false'"/></xsl:when><xsl:otherwise><xsl:value-of select="$v_matchSeriesColor"/></xsl:otherwise></xsl:choose></xsl:attribute>
  57. </xsl:if>
  58. </xsl:template>
  59. <xsl:template name="generateCombinationChartTypes">
  60. <xsl:choose>
  61. <xsl:when test="count(baltic:combinationChart/baltic:*) = 1">
  62. <!-- If there is only one chart type, process it (even if it has no chartMember) -->
  63. <xsl:apply-templates select="baltic:combinationChart/baltic:*"/>
  64. </xsl:when>
  65. <xsl:otherwise>
  66. <!-- If there is more than one chart type, ignore the ones that have no chartMember. -->
  67. <xsl:apply-templates select="baltic:combinationChart/baltic:*/baltic:chartMember/.."/>
  68. </xsl:otherwise>
  69. </xsl:choose>
  70. </xsl:template>
  71. <xsl:template name="fillNodesTemplate">
  72. <xsl:param name="p_refQuery"/>
  73. <xsl:variable name="p_mode" select="'rowEdge'"/>
  74. <xsl:variable name="p_base" select="../.."/>
  75. <xsl:variable name="p_addChartContents" select="'true'"/>
  76. <xsl:variable name="p_pos" select="'1'"/>
  77. <xsl:variable name="v_cube">
  78. <xsl:call-template name="getCubeOrCubeReference">
  79. <xsl:with-param name="p_queryNode" select="//baltic:BIQuery[@name=$p_refQuery]"/>
  80. </xsl:call-template>
  81. </xsl:variable>
  82. <xsl:variable name="v_chartNodeMembersExist">
  83. <xsl:for-each select="$p_base/baltic:chartLevel">
  84. <xsl:variable name="v_refDataItem" select="baltic:queryItemRef/@refItem"/>
  85. <xsl:variable name="v_chartNodesCount" select="count(//baltic:BIQuery[@name=$p_refQuery]/baltic:summary/baltic:*[local-name(.)=$p_mode]/baltic:level[position()=$p_pos]/baltic:item[@refItem=$v_refDataItem])"/>
  86. <xsl:if test="$v_chartNodesCount &gt; 0">true</xsl:if>
  87. </xsl:for-each>
  88. </xsl:variable>
  89. <xsl:choose>
  90. <xsl:when test="$v_chartNodeMembersExist != ''">
  91. <chartNodes>
  92. <chartNode>
  93. <chartNodeMembers>
  94. <xsl:for-each select="$p_base/baltic:chartLevel">
  95. <xsl:variable name="v_refDataItem" select="baltic:queryItemRef/@refItem"/>
  96. <xsl:variable name="v_chartNodesCount" select="count(//baltic:BIQuery[@name=$p_refQuery]/baltic:summary/baltic:*[local-name(.)=$p_mode]/baltic:level[position()=$p_pos]/baltic:item[@refItem=$v_refDataItem])"/>
  97. <xsl:if test="$v_chartNodesCount &gt; 0">
  98. <chartNodeMember refDataItem="{$v_refDataItem}">
  99. <chartContents>
  100. <chartTextItem>
  101. <xsl:call-template name="simpleLayoutGroupTemplate"/>
  102. <dataSource>
  103. <xsl:apply-templates select="baltic:queryItemRef"/>
  104. </dataSource>
  105. </chartTextItem>
  106. </chartContents>
  107. <xsl:if test="baltic:chartText">
  108. <chartLabel>
  109. <chartContents>
  110. <xsl:apply-templates select="baltic:chartText"/>
  111. </chartContents>
  112. </chartLabel>
  113. </xsl:if>
  114. <xsl:call-template name="sortListTemplate">
  115. <xsl:with-param name="p_cube" select="$v_cube"/>
  116. <xsl:with-param name="p_refDataItem" select="$v_refDataItem"/>
  117. <xsl:with-param name="p_base" select="$p_base"/>
  118. </xsl:call-template>
  119. </chartNodeMember>
  120. </xsl:if>
  121. </xsl:for-each>
  122. </chartNodeMembers>
  123. <!--
  124. If a combination chart element is already defined as the default measure
  125. of the chart, then don't add the nested chartNodeMember because it will
  126. be added as the defaultChartMeasure. See Trakker #487225.1.
  127. -->
  128. <xsl:if test="baltic:chartMember and baltic:chartMember/@refMember != ancestor::baltic:chart/baltic:chartMeasure/baltic:member/@refMember">
  129. <chartNestedNodes>
  130. <chartNode>
  131. <chartNodeMembers>
  132. <xsl:apply-templates select="baltic:chartMember">
  133. <xsl:with-param name="p_cube" select="$v_cube"/>
  134. <xsl:with-param name="p_base" select="$p_base"/>
  135. </xsl:apply-templates>
  136. </chartNodeMembers>
  137. </chartNode>
  138. </chartNestedNodes>
  139. </xsl:if>
  140. </chartNode>
  141. </chartNodes>
  142. </xsl:when>
  143. <xsl:otherwise>
  144. <xsl:if test="baltic:chartMember and baltic:chartMember/@refMember != ancestor::baltic:chart/baltic:chartMeasure/baltic:member/@refMember">
  145. <chartNodes>
  146. <chartNode>
  147. <chartNodeMembers>
  148. <xsl:apply-templates select="baltic:chartMember">
  149. <xsl:with-param name="p_cube" select="$v_cube"/>
  150. <xsl:with-param name="p_base" select="$p_base"/>
  151. </xsl:apply-templates>
  152. </chartNodeMembers>
  153. </chartNode>
  154. </chartNodes>
  155. </xsl:if>
  156. </xsl:otherwise>
  157. </xsl:choose>
  158. </xsl:template>
  159. <xsl:template match="baltic:combinationChart[not (@standardType='3DAxis')]/baltic:area">
  160. <area>
  161. <xsl:call-template name="processAttsTemplate"/>
  162. <xsl:call-template name="valueTypeTemplate">
  163. <xsl:with-param name="p_chart" select=".."/>
  164. </xsl:call-template>
  165. <xsl:call-template name="useNumericalAxisTemplate"/>
  166. <xsl:call-template name="fillNodesTemplate">
  167. <xsl:with-param name="p_refQuery" select="../../@refQuery"/>
  168. </xsl:call-template>
  169. </area>
  170. </xsl:template>
  171. <xsl:template match="baltic:combinationChart[not (@standardType='3DAxis')]/baltic:column">
  172. <bar>
  173. <xsl:call-template name="processAttsTemplate"/>
  174. <xsl:call-template name="valueTypeTemplate">
  175. <xsl:with-param name="p_chart" select=".."/>
  176. </xsl:call-template>
  177. <xsl:call-template name="useNumericalAxisTemplate"/>
  178. <xsl:call-template name="fillNodesTemplate">
  179. <xsl:with-param name="p_refQuery" select="../../@refQuery"/>
  180. </xsl:call-template>
  181. </bar>
  182. </xsl:template>
  183. <xsl:template match="baltic:combinationChart[not (@standardType='3DAxis')]/baltic:line">
  184. <xsl:variable name="v_depth" select="../@depth"/>
  185. <line>
  186. <xsl:if test="$v_depth = '0' or $v_depth = ''">
  187. <xsl:attribute name="showBorders">true</xsl:attribute>
  188. </xsl:if>
  189. <xsl:call-template name="chartMarkerTemplate">
  190. <xsl:with-param name="p_chart" select="."/>
  191. <xsl:with-param name="p_defaultShape" select="'square'"/>
  192. </xsl:call-template>
  193. <xsl:call-template name="processAttsTemplate"/>
  194. <xsl:call-template name="valueTypeTemplate">
  195. <xsl:with-param name="p_chart" select=".."/>
  196. </xsl:call-template>
  197. <xsl:call-template name="useNumericalAxisTemplate"/>
  198. <xsl:call-template name="fillNodesTemplate">
  199. <xsl:with-param name="p_refQuery" select="../../@refQuery"/>
  200. </xsl:call-template>
  201. </line>
  202. </xsl:template>
  203. <xsl:template match="baltic:chartMember">
  204. <xsl:param name="p_cube"/>
  205. <xsl:param name="p_base"/>
  206. <chartNodeMember refDataItem="{@refMember}">
  207. <xsl:variable name="v_refMember" select="@refMember"/>
  208. <xsl:variable name="v_chartMeasure" select="../../../baltic:chartMeasure[baltic:member[@refMember=$v_refMember]]"/>
  209. <xsl:choose>
  210. <xsl:when test="../../../baltic:chartMeasure[1]/baltic:member/@refMember=$v_refMember">
  211. <!-- Baltic only applies the style from the chart body for the first measure. see trakker 554842 -->
  212. <!-- get the CSS style and data format from the chartMeasure and chartBody-->
  213. <xsl:call-template name="mergeStylesFromChartBodyAndChartMeasure">
  214. <xsl:with-param name="p_chartBody" select="../../../baltic:chartBody"/>
  215. <xsl:with-param name="p_chartMeasure" select="$v_chartMeasure"/>
  216. </xsl:call-template>
  217. </xsl:when>
  218. <xsl:otherwise>
  219. <!-- Baltic did not apply the style from the chart body other than for the first measure. see trakker 554842 -->
  220. <xsl:if test="../../../baltic:chartBody/baltic:style">
  221. <xsl:comment>
  222. <xsl:value-of select="log:logInfo0(/baltic:report/logIdentifier/@logId, 'RSU_SPC_CHART_BODY_STYLE_IGNORED_FOR_NON_FIRST_MEASURE')" xmlns:log="http://developer.cognos.com/schemas/report/2.0/com.cognos.rspecupgrade.rsupgrade.internal.upgradepipeline.tools.LogMap"/>
  223. </xsl:comment>
  224. </xsl:if>
  225. <!-- tricky kludge passing a non-exist chart body, so there is nothing to override the measure. -->
  226. <xsl:call-template name="mergeStylesFromChartBodyAndChartMeasure">
  227. <xsl:with-param name="p_chartBody" select="/baltic:charBody"/>
  228. <xsl:with-param name="p_chartMeasure" select="$v_chartMeasure"/>
  229. </xsl:call-template>
  230. </xsl:otherwise>
  231. </xsl:choose>
  232. <chartContents>
  233. <chartTextItem>
  234. <dataSource>
  235. <memberCaption/>
  236. </dataSource>
  237. </chartTextItem>
  238. </chartContents>
  239. <xsl:if test="$v_chartMeasure/baltic:chartText">
  240. <chartLabel>
  241. <chartContents>
  242. <xsl:apply-templates select="$v_chartMeasure/baltic:chartText"/>
  243. </chartContents>
  244. </chartLabel>
  245. </xsl:if>
  246. <xsl:call-template name="sortListTemplate">
  247. <xsl:with-param name="p_cube" select="$p_cube"/>
  248. <xsl:with-param name="p_refDataItem" select="$v_refMember"/>
  249. <xsl:with-param name="p_base" select="../../.."/>
  250. </xsl:call-template>
  251. </chartNodeMember>
  252. </xsl:template>
  253. </xsl:stylesheet>