RSUpgradeBurst.xsl 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 match="baltic:burst">
  13. <!--
  14. * Detailed mappings for burst upgrade:
  15. *
  16. * burst -> burst
  17. * key/@refQuery -> burst/@refQuery
  18. * key/@refLevel -> burstGroup for each query level up to this one
  19. * key/@refItem -> burstLabel/@refDataItem
  20. * recipient -> burstRecipient
  21. * recipient/@refQuery -> burstRecipient/@refQuery
  22. * recipient/@refItem -> burstRecipient/@refDataItem
  23. * recipient/@type -> burstRecipient/@type
  24. -->
  25. <xsl:variable name="var_refQuery" select="baltic:key/@refQuery"/>
  26. <xsl:variable name="var_beringRefQuery">
  27. <xsl:call-template name="getQueryTemplate">
  28. <xsl:with-param name="refQuery" select="$var_refQuery"/>
  29. </xsl:call-template>
  30. </xsl:variable>
  31. <xsl:variable name="var_burstGroups">
  32. <!-- The structure of the V5 burstGroups is derived from the V4 Cube Dimension Levels. -->
  33. <xsl:apply-templates select="/baltic:report/baltic:querySet/baltic:BIQuery[@name=$var_refQuery]" mode="burst">
  34. <xsl:with-param name="p_refLevel" select="baltic:key/@refLevel"/>
  35. </xsl:apply-templates>
  36. </xsl:variable>
  37. <xsl:variable name="var_burstRecipient">
  38. <xsl:apply-templates select="baltic:recipient"/>
  39. </xsl:variable>
  40. <xsl:choose>
  41. <xsl:when test="$var_burstGroups/node()[local-name()='burstGroup'] and $var_burstRecipient/node()[local-name()='burstRecipient']">
  42. <burst refQuery="{$var_beringRefQuery}">
  43. <burstGroups>
  44. <xsl:copy-of select="$var_burstGroups"/>
  45. </burstGroups>
  46. <xsl:copy-of select="$var_burstRecipient"/>
  47. <xsl:if test="count(baltic:key/@refItem) &gt; 0">
  48. <burstLabel refDataItem="{baltic:key/@refItem}"/>
  49. </xsl:if>
  50. </burst>
  51. </xsl:when>
  52. <xsl:otherwise>
  53. <xsl:comment>
  54. <xsl:call-template name="logError0">
  55. <xsl:with-param name="p_msgId" select="'RSU_SPC_INVALID_BURST_SPECIFICATION'"/>
  56. </xsl:call-template>
  57. </xsl:comment>
  58. </xsl:otherwise>
  59. </xsl:choose>
  60. </xsl:template>
  61. <xsl:template match="baltic:recipient">
  62. <xsl:variable name="var_beringRefQuery">
  63. <xsl:call-template name="getQueryTemplate">
  64. <xsl:with-param name="refQuery" select="@refQuery"/>
  65. </xsl:call-template>
  66. </xsl:variable>
  67. <burstRecipient refQuery="{$var_beringRefQuery}" refDataItem="{@refItem}" type="{@type}"/>
  68. </xsl:template>
  69. <xsl:template match="/baltic:report/baltic:querySet/baltic:BIQuery" mode="burst">
  70. <xsl:param name="p_refLevel"/>
  71. <xsl:variable name="var_cube">
  72. <xsl:call-template name="getCubeOrCubeReference"/>
  73. </xsl:variable>
  74. <xsl:for-each select="$var_cube/baltic:cube/baltic:dimension/baltic:level[@name=$p_refLevel]/preceding-sibling::baltic:level">
  75. <xsl:apply-templates select="." mode="burst"/>
  76. </xsl:for-each>
  77. <xsl:apply-templates select="$var_cube/baltic:cube/baltic:dimension/baltic:level[@name=$p_refLevel]" mode="burst"/>
  78. </xsl:template>
  79. <xsl:template match="baltic:cube/baltic:dimension/baltic:level" mode="burst">
  80. <xsl:variable name="var_refLevel" select="@name"/>
  81. <xsl:variable name="v_refDataItem">
  82. <xsl:call-template name="getKeyItemNameForLevel"/>
  83. </xsl:variable>
  84. <xsl:choose>
  85. <xsl:when test="$v_refDataItem='ERROR: Cannot find item or dataItem for the level referenced.'">
  86. <xsl:comment>
  87. <xsl:call-template name="logError2">
  88. <xsl:with-param name="p_msgId" select="'RSU_SPC_LEVEL_KEYITEM_MISSING'"/>
  89. <xsl:with-param name="p_param1" select="'burstGroup'"/>
  90. <xsl:with-param name="p_param2" select="$var_refLevel"/>
  91. </xsl:call-template>
  92. </xsl:comment>
  93. </xsl:when>
  94. <xsl:otherwise>
  95. <burstGroup refDataItem="{$v_refDataItem}">
  96. <!-- Generate sortList from the baltic:item sort attributes up to this level in the current dimension. -->
  97. <sortList>
  98. <xsl:apply-templates select="baltic:item" mode="generate_sortItems"/>
  99. </sortList>
  100. </burstGroup>
  101. </xsl:otherwise>
  102. </xsl:choose>
  103. </xsl:template>
  104. </xsl:stylesheet>